Use unsigned int instead of uint in BINARY_INFO_MAKE_TAG #3029

Merged
loopj merged 2 commits from portable-bininfo-maketag into develop 2026-06-30 09:15:44 -05:00
loopj commented 2026-06-24 14:28:32 -05:00 (Migrated from github.com)

Adjust the BINARY_INFO_MAKE_TAG macro in the binary_info module to use unsigned int instead of uint, making it more portable without users having to typedef uint themselves, since this isn't a standard stdint type.

Makes the binary_info headers more portable (as intended) and is backwards compatible.

Fixes #3028

Adjust the [BINARY_INFO_MAKE_TAG](https://github.com/raspberrypi/pico-sdk/blob/develop/src/common/pico_binary_info/include/pico/binary_info/structure.h#L45) macro in the binary_info module to use `unsigned int` instead of `uint`, making it more portable without users having to typedef `uint` themselves, since this isn't a standard stdint type. Makes the `binary_info` headers more portable (as intended) and is backwards compatible. Fixes #3028
kilograham (Migrated from github.com) reviewed 2026-06-24 14:28:32 -05:00
lurch (Migrated from github.com) reviewed 2026-06-24 16:45:02 -05:00
@ -42,7 +42,7 @@ typedef struct _binary_info_core binary_info_t;
// note plan is to reserve c1 = 0->31 for "collision tags"; i.e.
lurch (Migrated from github.com) commented 2026-06-24 16:45:01 -05:00

If both c1 and c2 are being ANDed with 0xff, I guess that unsigned char would be sufficient? 🤔

If both `c1` and `c2` are being ANDed with 0xff, I guess that `unsigned char` would be sufficient? :thinking:
loopj (Migrated from github.com) reviewed 2026-06-24 17:45:31 -05:00
@ -42,7 +42,7 @@ typedef struct _binary_info_core binary_info_t;
// note plan is to reserve c1 = 0->31 for "collision tags"; i.e.
loopj (Migrated from github.com) commented 2026-06-24 17:45:31 -05:00

I was aiming to make the diff as trivial as possible. I can change to unsigned char if preferred, they generate the same result either way.

The generated assembly is identical for both at O1 and greater so there isn't really a real world benefit, so it just comes down to a style preference.

I was aiming to make the diff as trivial as possible. I can change to `unsigned char` if preferred, they generate the same result either way. The generated assembly is identical for both at O1 and greater so there isn't really a real world benefit, so it just comes down to a style preference.
lurch (Migrated from github.com) reviewed 2026-06-25 01:53:33 -05:00
@ -42,7 +42,7 @@ typedef struct _binary_info_core binary_info_t;
// note plan is to reserve c1 = 0->31 for "collision tags"; i.e.
lurch (Migrated from github.com) commented 2026-06-25 01:53:32 -05:00

This is probably a question for @kilograham then. Although note that:

$ git grep BINARY_INFO_MAKE_TAG
src/common/pico_binary_info/include/pico/binary_info/structure.h:#define BINARY_INFO_MAKE_TAG(c1, c2) ((((uint)c2&0xffu)<<8u)|((uint)c1&0xffu))
src/common/pico_binary_info/include/pico/binary_info/structure.h:#define BINARY_INFO_TAG_RASPBERRY_PI BINARY_INFO_MAKE_TAG('R','P')
test/kitchen_sink/kitchen_sink.c:                           BINARY_INFO_MAKE_TAG('K', 'S'),
This is probably a question for @kilograham then. Although note that: ```bash $ git grep BINARY_INFO_MAKE_TAG src/common/pico_binary_info/include/pico/binary_info/structure.h:#define BINARY_INFO_MAKE_TAG(c1, c2) ((((uint)c2&0xffu)<<8u)|((uint)c1&0xffu)) src/common/pico_binary_info/include/pico/binary_info/structure.h:#define BINARY_INFO_TAG_RASPBERRY_PI BINARY_INFO_MAKE_TAG('R','P') test/kitchen_sink/kitchen_sink.c: BINARY_INFO_MAKE_TAG('K', 'S'), ```
kilograham (Migrated from github.com) reviewed 2026-06-29 12:09:12 -05:00
kilograham (Migrated from github.com) approved these changes 2026-06-29 16:48:01 -05:00
will-v-pi (Migrated from github.com) approved these changes 2026-06-30 04:15:30 -05:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk!3029
No description provided.