in reply to Named Bits in a 32-bit integer
then running the script will produce:#!/usr/bin/perl -P # set this to the bit masks #define ONE 1 #define TWO 2 #define THREE 3 #define FOUR 4 print "bitwise AND (ONE & FOUR)=", ONE & FOUR, "\n"; print "bitwise AND (ONE & THREE)=", ONE & THREE, "\n";
$ ./script.pl bitwise AND (ONE & FOUR)=0 bitwise AND (ONE & THREE)=1
If perl -P gives an error where it can't find cpp, you can probably copy the one from your gcc dist into a directory into your path.
--
hiseldl
|
|---|