bnot()
Perform bitwise NOT operation for the given number x
. Every bit of x
will be inverted
bnot(x, bit_width = 32, unsigned = false)
x
(number) — A numberbit_width
(number, optional) — The given number x
and the returned value will be cast to bit_width
-bit integer. bit_width
must be in between 1 and 32. The default value is 32unsigned
(boolean, optional) — If unsigned
is true
then the sign bit of x
and the returned value will be ignored. The default value is false
number
— Returns the inverted value of x
a = bnot(0) ' a = -1 -> Where the negation of 00000000000000000000000000000000 is 11111111111111111111111111111111 (-1 in signed 32-bit)
b = bnot(0, 8, true) ' b = 255 -> Where the negation of 00000000 is 11111111 (255 in unsigned 8-bit)
c = bnot(0x0f, 8, true) ' c = 240 -> Where the negation of 00001111 is 11110000 (240 in unsigned 8-bit)
This function is available on Dinfio version 3.1.06 or later