Reputation: 809
The header file <stdint.h>
usually provides typedefs and macro constants for integers of 8, 16, 32 and 64 bit width.
The standard also allows any N-bit type to be specified by using identifiers of the form uintN_t
, etc, although I personally have yet to encounter a platform for which any beyond the common four already mentioned are defined.
Curiously, the source code for the Clang/LLVM stdint.h
provides conditional support for every N-bit type that is a multiple of 8, from 8 to 64. Code fragment (source):
#ifdef __INT48_TYPE__
typedef __INT48_TYPE__ int48_t;
typedef __UINT48_TYPE__ uint48_t;
typedef int48_t int_least48_t;
typedef uint48_t uint_least48_t;
typedef int48_t int_fast48_t;
typedef uint48_t uint_fast48_t;
# define __int_least32_t int48_t
# define __uint_least32_t uint48_t
# define __int_least16_t int48_t
# define __uint_least16_t uint48_t
# define __int_least8_t int48_t
# define __uint_least8_t uint48_t
#endif /* __INT48_TYPE__ */
#ifdef __INT40_TYPE__
typedef __INT40_TYPE__ int40_t;
typedef __UINT40_TYPE__ uint40_t;
typedef int40_t int_least40_t;
typedef uint40_t uint_least40_t;
typedef int40_t int_fast40_t;
typedef uint40_t uint_fast40_t;
# define __int_least32_t int40_t
# define __uint_least32_t uint40_t
# define __int_least16_t int40_t
# define __uint_least16_t uint40_t
# define __int_least8_t int40_t
# define __uint_least8_t uint40_t
#endif /* __INT40_TYPE__ */
Now why might they have done this? Is this wishful thinking on the part of the Clang developers ("you never know when one day a system with 40-bit native arithmetic might come around!") or are there actually some systems somewhere where built-in support for this stuff is provided?
Upvotes: 0
Views: 221