Being a GCC user, I've just noticed clang supports a uint24_t
type (it's in their stdint.h
anyway).
How does that work? I mean, is it supported purely internally, as a language extension, or is it implemented like a C++ class would, with some abstraction over 3 bytes or a 16-bit value and another 8-bit value? And - how possible is it to 'yank' such an implementation and use it myself, with GCC?
Note:
uint_t<N>
more generally); my alternative is rolling my own.s/uint/int/g;
if you like in this question.This isn't portable or standard. It exists only for AVR (which has 24-bit addresses), and GCC has it for that architecture, too (since GCC v4.7).
If the architecture doesn't support a native 24-bit integer, then it won't be defined.
If you look in Clang's stdint.h
header file, you'll see that the 24-bit integer typedefs are conditionally included only when the internal __INT24_TYPE__
symbol is defined:
#ifdef __INT24_TYPE__
typedef __INT24_TYPE__ int24_t;
typedef __UINT24_TYPE__ uint24_t;
typedef int24_t int_least24_t;
typedef uint24_t uint_least24_t;
typedef int24_t int_fast24_t;
typedef uint24_t uint_fast24_t;
# define __int_least16_t int24_t
# define __uint_least16_t uint24_t
# define __int_least8_t int24_t
# define __uint_least8_t uint24_t
#endif /* __INT24_TYPE__ */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With