bit-set
cur-val bit-posSummary
Set bit-pos within cur-val to 1
Arguments
cur-val
The integer where we set the bit in
bit-pos
The index of the bit we want to change, with 0 being the least significant digit
Return value
An integer cur-val but with a guaranteed 1 at bit-pos
Examples
(bit-set 11 2) 15
Bytecode
Probably only interesting to you if you want to understand more about the Nujel VM or care very much about performance.
( 0 ($get/val 'bit-or)) ( 2 ($get/val 'cur-val)) ( 4 ($get/val 'bit-shift-left)) ( 6 ($push/int/byte 1)) ( 8 ($get/val 'bit-pos)) ( 10 ($apply 2)) ( 12 ($apply 2)) ( 14 ($ret))