home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
c
/
cnews016.arc
/
SETS.ARC
/
SETSOURC.ARC
/
WORDLEN.C
< prev
Wrap
C/C++ Source or Header
|
1989-03-09
|
792b
|
24 lines
#include <stdio.h>
#include <stdarg.h>
#include "sets.h"
/***************************************************************************/
unsigned wordlength(void)
/***************************************************************************/
/* This determines the number of bits in a standard unsigned integer. */
{
unsigned x,y; /* this is standard word length */
x = y = 0; /* zero all bits */
x = ~x; /* set all bits to '1' */
do {
x = x << 1; /* shift all bits 1 place to left; fill LSB with '0' */
y++; /* count the number of shifts */
} while(x != 0); /* when x == 0, all bits have been shifted out */
return y; /* y == number of bits in word */
} /* end wordlength */