Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: 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.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: 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.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Sat Sep 18, 2010 5:35 pm   
 
To clear a bit:
Code:
%bitset(Number_to_Set, Bit, 0)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net