bit.set
| Syntax |
bit.set (bits, bitnum)
|
| Params |
bits is a 32-bit number. bitnum is a number between 0 and 31.
|
| Action |
Turns on the indicated bit and returns the result.
|
| Returns |
A 32-bit number containing the bit pattern in bits with bit number bitnum turned on.
|
| Examples |
bit.set (0, 8) // only bit 8 is on » 256
bit.set (bit.set (0, 3), 4) // bits 3 and 4 are on
bit.set (0, 30) // only bit number 30 is on
string.hex (bit.set (0, 30)) // hex format is useful for viewing bit patterns
|
| See Also |
bit.get
|