Change in libosmocore[master]: add/clean big-endian packed structs (struct_endianess.py)

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Nov 16 10:49:20 UTC 2018


Pau Espin Pedrol has posted comments on this change. ( https://gerrit.osmocom.org/11787 )

Change subject: add/clean big-endian packed structs (struct_endianess.py)
......................................................................


Patch Set 2: Code-Review-1

(2 comments)

https://gerrit.osmocom.org/#/c/11787/2/include/osmocom/gprs/protocol/gsm_04_60.h
File include/osmocom/gprs/protocol/gsm_04_60.h:

https://gerrit.osmocom.org/#/c/11787/2/include/osmocom/gprs/protocol/gsm_04_60.h@33
PS2, Line 33: 	uint8_t tfi_hi:2, cv:4, si:1, r:1;
Please change the script to add lines/formatting like in the little endian case.


https://gerrit.osmocom.org/#/c/11787/2/include/osmocom/gsm/protocol/gsm_03_41.h
File include/osmocom/gsm/protocol/gsm_03_41.h:

https://gerrit.osmocom.org/#/c/11787/2/include/osmocom/gsm/protocol/gsm_03_41.h@36
PS2, Line 36: 		uint8_t language:4;
Be careful here!!
Big endian generated code is not the same as in little endian.

In little endian you are saying: I have 2 bytes, and for each I only care about the lower 4 bits (so it should never handle values greater than 16).

In the big endian you are saying: I have 1 byte, and 4 lower bits are repreented by one variable, and the 4 higher bits by the other variable.

So I see 2 possible issues here:
* original little endian strucut looks suspicously wrong. Probably we want 1 byte with 2 variables instead of 2 bytes with 2 variables. We need to check that in specs.
* Regardless of that, the script checking for endianess should take care of this case, since it's valid in general and used in some cases.



-- 
To view, visit https://gerrit.osmocom.org/11787
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia0b99d76932aeb03e93bd0c62d3bf025dec5f9d2
Gerrit-Change-Number: 11787
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Comment-Date: Fri, 16 Nov 2018 10:49:20 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181116/c82b6641/attachment.htm>


More information about the gerrit-log mailing list