The Global Archicad Community

Stay informed. Get help. Share your knowledge.

Everything about using Libraries and Library Parts - Doors/Windows/Objects/Stairs etc. (Example: How can I display a Transom above my Door?)

Moderators: Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, Gordana Radonic, nbalogh, mnguyen, gkmethy, Gergely Feher

User avatar
By Moonlight
#303327
Hi there,

Can someone put a practical example for the use of BITEST & BITSET ?

*Cause I have always seen them being mentioned in GDL manual but never an example that explains how to use them.
#303332
The masking and status values of some other GDL commands are based on set and unset bits of their binary notation. These functions can be analyzed in binary form.
Example: You have a masking Value of 63, which is 1*1 + 1*2 + 1*4 + 1*8 + 1*16 + 1*32
With Bittest you can check, which of these Bits are set or you can check if one of the Bits is set.
val = 63
TEXT2 0, 0, BITTEST(val, 4) ! = 1
This checks, if the 5th value is set (the value 16); the 1st value (1) is on position 0,
so you have to check
TEXT2 0, 0, BITTEST(val, 0) ! = 1
The binary notation of 63 would be 111111 (this is identical with the italic written 1s above), of 64 would be 1000000