Thread: Signed Ints??
View Single Post
  #3   Spotlight this post!  
Unread 22-02-2004, 10:15
DanL DanL is offline
Crusty Mentor
FRC #0097
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Somerville, MA
Posts: 682
DanL is just really niceDanL is just really niceDanL is just really niceDanL is just really niceDanL is just really nice
Send a message via AIM to DanL
Re: Signed Ints??

Kinda on a similair topic, how can you create a single-bit variable - kinda like a bool - using c?

This whitepaper says you can use individual bits like so:

Code:
struct bits {
unsigned int itsy: 3; // Use 3 bits as the variable ?itsy?
unsigned int bitsy: 3; // Use 3 bits as the variable ?bitsy?
unsigned int teensy: 1; // Use 1 bit as the variable ?teensy?
unsigned int weensey:1 // Use 1 bit at the variable ?weensy?
};
but the "itsey: 3;" syntax doesn't seem to work unless you are using it inside a struct. I'm sure there's a way more elegant than using a struct, but can anyone let me know what it is?
__________________
Dan L
Team 97 Mentor
Software Engineer, Vecna Technologies