home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
lclint.zip
/
lclint-2_3h-os2-bin.zip
/
test
/
tests2.2a
/
bitops.c
< prev
next >
Wrap
Text File
|
1997-09-03
|
478b
|
31 lines
int f (int i1, int i2, unsigned u1, unsigned u2)
{
int x = i1 & i2; /* not unsigned */
unsigned u = u1 & i2;
short s = i1 & i2; /* not unsigned */
short s2 = i1 + i2;
u = u1 | u2;
u = i1 << 3; /* left operand not unsigned */
u = u1 >> 4; /* okay */
u = u1 >> i1;
u >>= 3;
u = i1 ^ u1; /* ! not unsigned */
u = u1 ^ i1; /* ! not unsigned */
return x;
}
/*
>>, >>=
<<, <<=
warn if not unsigned
&, &=
|, |=
^ (XOR), ^=
warn if not unsigned
*/