Skip to content

Resolve endian-less types in array, choice and pointer by endianness() - #351

Merged
keichi merged 1 commit into
masterfrom
array-type-endianness
Nov 22, 2026
Merged

keichi merged 1 commit into
masterfrom
array-type-endianness

Conversation

@keichi

@keichi keichi commented Nov 22, 2026

Copy link
Copy Markdown
Owner

The array examples in README use element types without an endian suffix (e.g. type: "int32"), but array() rejected them with Array element type "int32" is unknown.

This PR makes array(), choice() (choices and defaultChoice) and pointer() accept [u]int{16,24,32,48,64}, float and double without a suffix and resolve them using the parser's endianness() (big endian by default), the same way uint16(), float() etc. do. Aliases registered with namely() take precedence, and types with an explicit suffix are unchanged.

As with uint16(), the endianness is resolved when the field is defined, so endianness() must be called before it.

  • Add tests for array, choice and pointer
  • Update the type description of array and pointer in README

README examples use types such as "int32" for array elements, but such
types were rejected as unknown. Append the parser's endianness to them, in
the same way as uint16() and friends do.
@keichi
keichi merged commit df8d78b into master Nov 22, 2026
6 checks passed
@keichi
keichi deleted the array-type-endianness branch November 22, 2026 10:49
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.

1 participant