|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sat Sep 18, 2010 6:49 am
[3.27] Bittest and Bitset |
Since there is no documentation on the new functions %bitset and %bittest I played around with them and arrived at their syntax by trial and error. This post is for anyone who needs the syntax:
%bittest(Number_to_Test, Bit)
Returns a 1 if the specified 'Bit' in 'Number_to_Test' is a '1'. Returns '0' otherwise.
%bitset(Number_to_Set, Bit)
Returns 'Number_to_Set' with the specified 'Bit' set to '1'.
I found it odd that you'd only provision to setting the bits and not for clearing them, but then again all of this can be done with boolean operations anyway so the above seem only for convenience anyway. Clearing/setting bits can be done with bitwise 'and' and 'or' operations. |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sat Sep 18, 2010 7:06 am |
Actually they are documented. %bittest and %bitset. You can get the latest update to the documentation by opening up CMUDs Help window and click the 'Get Updates' button.
|
|
_________________ Asati di tempari! |
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sat Sep 18, 2010 2:36 pm |
I had tried pulling it up in the local docs without success and then I had used the search function on the zuggsoft site to try to search for it. Neither of those methods found it, so it had appeared to me as though they weren't there. Odd that the site search didn't find it.
Thanks Tech. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sat Sep 18, 2010 5:35 pm |
To clear a bit:
Code: |
%bitset(Number_to_Set, Bit, 0) |
|
|
|
|
|
|