Difference between revisions of "Bit32.bnot"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
Line 7: Line 7:
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
(number) = bit32.bnot(x)
 
(number) = bit32.bnot(x)
</source>
+
</syntaxhighlight>
  
 
For any integer x, the following identity holds:
 
For any integer x, the following identity holds:
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
assert(bit32.bnot(x) == (-1 - x) % 2^32)
 
assert(bit32.bnot(x) == (-1 - x) % 2^32)
</source>
+
</syntaxhighlight>
  
 
=== Parameters ===
 
=== Parameters ===

Latest revision as of 15:26, 13 July 2023

Available since: Gideros 2022.3
Class: bit32

Description

Returns the bitwise negation of x.

(number) = bit32.bnot(x)

For any integer x, the following identity holds:

assert(bit32.bnot(x) == (-1 - x) % 2^32)

Parameters

x: (number) value

Return values

Returns (number) result

See also

Bitwise Operators