Code: Select all
int bitstate(int value, char bit, char status)
{
return ((value & (1 << bit)) >> bit == status);
}
Code: Select all
bitstate(0xFFF00000, 31, 1);
Code: Select all
(0xFFF00000 & (1 << 31)) >> 31 == ON;
Code: Select all
int bitstate(int value, char bit, char status)
{
return ((value & (1 << bit)) >> bit == status);
}
Code: Select all
bitstate(0xFFF00000, 31, 1);
Code: Select all
(0xFFF00000 & (1 << 31)) >> 31 == ON;
Code: Select all
typedef enum {OFF = 0, ON = 1} BitStatus;
Erm... actually, no standard header is allowed to include some other standard header. I haven't checked what GCC actually does in regards to these two, but if inttypes.h includes stdint.h, that's non-conformig behaviour (i.e., a bug).Schol-R-LEA wrote: [tt]uint8_t[/tt] (defined in [tt]<stdint.h>[/tt], though you usually want to use <inttypes.h>, which includes it)
As I said, I have the standard docs here, conveniently converted from PDF to text so I can do full-text searches and copy&paste on my PDA. I used Dinkumware as a kind of "secondary reference", but an error as big as this one will make me think twice from now on...df wrote: ouch. dont write dinukware off, i dont know of any better sites that offer what they do for libc info...