` Printed Icetips Article

Icetips Article



Par2: Bit manipulation (BAND)
2000-12-20 -- Tom Leech
 
Some time ago I wrote a little function that given the mask and the
particular bit position you wanted to check, the function returns true if a
1 is in that bit or false if its 0.

CompareMask          PROCEDURE  (msk,indx)
ReturnValue             Byte
MIndex                  long
  CODE

MIndex      = Bshift(1,Indx-1)           ! Shift a 1 into the proper
position (base 0)
if Band(msk,MIndex) = Mindex        ! If in mask and equals Mindex then
TRUE
   ReturnValue = TRUE
else
   ReturnValue = FALSE
end



Printed November 23, 2024, 3:34 am
This article has been viewed/printed 35215 times.