Re: and_bits() usage
- Posted by ghaberek (admin) Oct 07, 2009
- 1103 views
Here is how I use and_bits().
constant FLAG1 = #0001 constant FLAG2 = #0002 constant FLAG3 = #0004 constant FLAG4 = #0008 atom flags = or_bits( FLAG1, FLAG3 ) -- flags is #0005 if and_bits( flags, FLAG1 ) then -- output is #0001 (true) -- FLAG1 is set end if if and_bits( flags, FLAG2 ) then -- output is #0000 (false) -- FLAG2 is set end if if and_bits( flags, FLAG3 ) then -- output is #0004 (true) -- FLAG3 is set end if if and_bits( flags, FLAG4 ) then -- output is #0000 (false) -- FLAG4 is set end if
-Greg