D
dr.oktopus
Hello,
simple question: what is the most appropriate type for implement a bit
array type for
operations like anding, oring, etc..
simple answer: well, it should be the word size of the microprocessor
you are using.
More exactly, it should be the largest word the os allow you. So, if
you are running
x86 linux on a 64-bit microprocessor, it is 32 bit. But how detect it?
Looking around
seems no obvious answer exists. Most code I've seen get it from a
configuration file.
This is from libSDL:
#ifdef SDL_HAS_64BIT_TYPE
typedef int64_t Sint64;
SDL_HAS_64BIT_TYPE is defined in different headers for different
platforms.
I would like to know if there is any chance to get info on 64 bit type
availability.
Moreover, I need to define a macro based on this type, that use a gcc
builtin (in my case one of __builtin_clz, __builtin_clzl,
__builtin_clzll)
of the appropriate size, or a custom function if no builtin is
available on
that platform (or version of the compiler).
Can you point me any link about correct usage of gcc builtins?
simple question: what is the most appropriate type for implement a bit
array type for
operations like anding, oring, etc..
simple answer: well, it should be the word size of the microprocessor
you are using.
More exactly, it should be the largest word the os allow you. So, if
you are running
x86 linux on a 64-bit microprocessor, it is 32 bit. But how detect it?
Looking around
seems no obvious answer exists. Most code I've seen get it from a
configuration file.
This is from libSDL:
#ifdef SDL_HAS_64BIT_TYPE
typedef int64_t Sint64;
SDL_HAS_64BIT_TYPE is defined in different headers for different
platforms.
I would like to know if there is any chance to get info on 64 bit type
availability.
Moreover, I need to define a macro based on this type, that use a gcc
builtin (in my case one of __builtin_clz, __builtin_clzl,
__builtin_clzll)
of the appropriate size, or a custom function if no builtin is
available on
that platform (or version of the compiler).
Can you point me any link about correct usage of gcc builtins?