Skip to content

Support for architecture with 16-bit integers #608

@THQ-WIFA

Description

@THQ-WIFA

Is your feature request related to a problem? Please describe.
I have an (old) compiler/architecture where sizeof(int) is 16.
Trice relies on 32-bit integers when shifting IDs and the like. With explicit sizes, that is easily provided.
Trice also has some random magic numbers that are 32-bit. Restricting the values to use 16 bit should do the job as well.

Describe the solution you'd like
Use casts to fast-32-bit integers (mostly, uint_fast32_t) before shifting values, where 32 bit width are expected.
Use long integer literals (suffix 'l') where (at least) 32 bit width are expected.

Describe alternatives you've considered
A simple cast to uint32_t works, but might be slower on 64-bit architectures.
A #define to choose magic number width seems like overengineering.

Proposal
I will provide an appropriate pull request soon.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions