Jump to content

Sign in to follow this  
Softegg

Bit comparison in ofp

Recommended Posts

i want to do a bit comparison to find out, if a bit is set in a value.

sample:

40 and 32 -> result 32

other sample:

16 and 8 -> result 0

but the and-command in ofp does not work in this case. i am not such a big mathematican, so anyone knows a workaround for this?

Share this post


Link to post
Share on other sites

Well close to this comes:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_x = 40;

if ( _x mod 64 >= 32 ) then { hint "32 bit set!"; };

untested, but it should work as intended. For the 8bit you must use _x mod 16 a.s.o.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×