Archives


- Beowulf
- Beowulf Announce
- Scyld-users
- Beowulf on Debian

How can I compute the range of signed and unsigned types

Many of your questions may have already been answered in earlier discussions or in the FAQ. The search results page will indicate current discussions as well as past list serves, articles, and papers.

Search

Walter B. Ligon III walt at clemson.edu
Wed Apr 18 10:03:26 PDT 2001


--------
> Errrrr... :-) have fun
> 
> 
> #include <stdio.h>
> 
> #define BYTESIZE(me)    (sizeof(me))
> #define BITSIZE(me)     (2 << sizeof(me))

please excuse my ignorance - but what exactly is BITSIZE doing here?
I don't understand and the results I get don't seem to make sense.
I would have written it as:

#define BITSIZE(me) (8 * sizeof(me))

but of course that assumes 8 bits per byte (which is normal, but not
strictly true (see old CDC machines).

Walt
-- 
Dr. Walter B. Ligon III
Associate Professor
ECE Department
Clemson University






More information about the Beowulf mailing list