lol - your doing the same thing i'm doing. Agreed, we need the one's complement not operator. Here's what I have so far:
break on
if testbit(9,8) ; is bit 4 (from the right) of 1001 set ? (it is)
? setbit(9,4) ; set bit 3 on (answer should be 1101 or 13
endif
exit 1
function setbit($a,$b)
$setbit = $a | $b
endfunction
function testbit($a,$b)
$testbit = $a & $b
endfunction
function clearbit($a,$b)
; To be done
endfunction
Like some c programmers (k&r man myself), I carry around a header file of usefull macro's. And especially I use these three all the time ... wouldn't be caught dead without them :
#define SETBIT(x, b) ((x) |= (b))
#define CLEARBIT(x, b) ((x) &= ~(b))
#define TESTBIT(x, b) ((x) & (b))
So just need to work-out the clearbit math and we're SET (sort-of-speak) :
-Shawn
[ 05 December 2001: Message edited by: Shawn ]