-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core: Compile time byte swapping for HTONS, HTONL, NTOHS, NTOHL etc. #3812
Comments
Doesn't byteorder.h provide these macros?
|
Only static inline functions, these the compiler can't optimize when defining enum's. |
Good idea. |
postponed to 2016.07 |
Postponed again to 2010.10 |
How about #5453 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
To convert the supplied argument `htons` and friends will use a simple formula instead of a function call, iff the value of the argument is known at compile time. This enables the use in enum definitions such as: ```c typedef enum { A = htons(0x0001), AAAA = htons(0x001C), } dns_query_type; ``` Fixes RIOT-OS#3812
To convert the supplied argument `htons` and friends will use a simple formula instead of a function call, iff the value of the argument is known at compile time. This enables the use in enum definitions such as: ```c typedef enum { A = htons(0x0001), AAAA = htons(0x001C), } dns_query_type; ``` Fixes RIOT-OS#3812
This would be useful so you can create enums like:
We already use this our self in some projects.
The text was updated successfully, but these errors were encountered: