bit-clear

cur-val bit-pos


Summary

Clear the bit at bit-pos within cur-val

Arguments

cur-val
The integer where we clear the bit in
bit-pos
The index of the bit we want to clear, with 0 being the least significant digit

Return value

An integer cur-val but with the bit at position bit-pos forced to 0

Examples

(bit-clear 11 2)
11

(bit-clear 11 1)
9

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-and))
(    2 ($get/val 'cur-val))
(    4 ($get/val 'bit-not))
(    6 ($get/val 'bit-shift-left))
(    8 ($push/int/byte 1))
(   10 ($get/val 'bit-pos))
(   12 ($apply 2))
(   14 ($apply 1))
(   16 ($apply 2))
(   18 ($ret))