home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 1
/
FishNMoreVol1.bin
/
more
/
code_examples
/
librar
/
addbit.c
< prev
next >
Wrap
Text File
|
1989-02-08
|
761b
|
34 lines
/*--------------------------------------*/
/* */
/* ADDBIT(X) */
/* */
/* Functionality: */
/* Marks the first off bit of an */
/* integer which is on when */
/* scanning from right to left. */
/* Arguments: */
/* 0: The integer to scan. */
/* Functions used: */
/* POWER() */
/* Returns: Nothing */
/* Author: John Callicotte */
/* Date created/modified: 09/01/88 */
/* */
/*--------------------------------------*/
void addbit(b)
int b[];
{
int d,j;
if (b[0]==32767) /* No bits to turn on, so we leave */
goto END;
for (j=0;j<16;j++){
d=power(2,j);
if (b[0]<d){
b[0]+=d;
j=16;
}
}
END: ;
}