Skip to content

Portability: writing of CompactSize values depends on the sizes of unsigned {short,int} #2137

@daira

Description

@daira

https://github.com/zcash/zcash/blob/master/src/serialize.h#L238-L276

The assumption here is that unsigned short is exactly 16 bits and unsigned int is exactly 32 bits. Either add an assertion to that effect, or (better) just use 0xFFFFu in place of std::numeric_limits<unsigned short>::max() and 0xFFFFFFFFu in place of std::numeric_limits<unsigned int>::max().

Metadata

Metadata

Assignees

Labels

C-cleanupCategory: PRs that clean code up or issues documenting cleanup.M-has-prTo-be-removed (GitHub has linked:pr filter)portability

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions