Skip to content

Add int24, uint24, int48 and uint48 parsers - #350

Merged
keichi merged 2 commits into
masterfrom
fix-issue-93-int24
Nov 22, 2026
Merged

keichi merged 2 commits into
masterfrom
fix-issue-93-int24

Conversation

@keichi

@keichi keichi commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Adds int24/int24le/int24be, uint24/uint24le/uint24be, and the same set for 48 bits. The unsuffixed variants follow endianness(), like the other integer primitives. The suffixed types also work as array/choice element types and in sizeOf().

DataView has no 24- or 48-bit getters, so the generated code builds the value from narrower reads. 48-bit values fit in a safe integer, so they are returned as number (same as Buffer#readIntBE(offset, 6)), not bigint. All primitive reads now go through a shared readPrimitive() helper instead of four copies of the same template.

Tests use the big-endian data from the issue (f959a61a57c80fd3004801a9 → -435802, 1726408). The other expected values come from Buffer#readIntBE/readIntLE/readUIntBE/readUIntLE on the same data.

Fixes #93

Add int24/int24le/int24be and uint24/uint24le/uint24be. The unsuffixed
variants follow endianness(). They are also usable as array element and
choice types and are accounted for in sizeOf().
48-bit values fit in a safe integer, so they are returned as number
(matching Buffer#readIntBE/readUIntBE with byteLength 6) rather than
bigint.
@keichi keichi changed the title Add int24 and uint24 parsers Add int24, uint24, int48 and uint48 parsers Nov 22, 2026
@keichi
keichi merged commit e245afc into master Nov 22, 2026
6 checks passed
@keichi
keichi deleted the fix-issue-93-int24 branch November 22, 2026 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

int24 and uint24 support

1 participant