Skip to content

Conversation

@redawl
Copy link
Contributor

@redawl redawl commented Apr 26, 2025

I noticed the docs for gwsettings had what I believe is a mistake in the explanation for how segment_bitmask is used in the firmware.

@jclehner
Copy link
Owner

Thanks. What I'm also noticing though is a discrepancy between the footer format described here, with segment_bitmask being a 16 bit integer, vs 32 bit in gwsettings.cc.

I'll investigate that further.

@redawl
Copy link
Contributor Author

redawl commented May 3, 2025

I've been taking a look at this.

From the docs, the previous 2 bytes before the segment_bitmask are padding, and are always 0xFFFF. Because of that, parsing the last 4 bytes as an int32_t or parsing the last two bytes as an int16_t are equivalent.

Using the example from the docs, this c code shows they are equivalent:

int a =  -1 * (int32_t)(0xfffffffc);
int b = -1 * (int16_t)(0xfffc);

printf("Are these equivalent? %d = %d\n", a, b);

outputs:

Are these equivalent? 4 = 4

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