Skip to content

Conversation

@ngjunsiang
Copy link
Contributor

This PR fixes a bug in #73 that caused SpreadSpectrum's struct to be created with 32 bits instead of 16 bits. The use of c_uint for all integer fields was the direct cause.

Changes:

  • simplified field descriptions for creating a bitfield: instead of passing ctypes types, devs pass a bitfield.INTEGER constant and a bitsize.
  • The bytesize= argument is removed; marshalledSize of bitfields is calculated on creation with a sanity check.
  • a _field() helper function converts the field description to an appropriate _fields_ class variable, deciding the appropriate ctypes type to use.

JS added 6 commits October 1, 2025 00:27
This simplifies definition of bitfields, which would otherwise require specifying ctypes ctypes.
The buggy code used c_uint for all integer fields, resulting in the SpreadSpectrum struct
being padded out to 32 bits instead of being 16 bits.

The fix uses the field() helper function to specify the correct ctype to use,
greatly simplifying the process of defining bitfields.
The bytesize can be calculated from the field descriptions, simplifying the interface
and reducing the chance of human error.
@leif81 leif81 merged commit ac84222 into open-dis:master Oct 1, 2025
2 checks passed
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.

2 participants