Difference between revisions of "Bit32.bnot"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2022.3<br/> '''Class:''' bit32<br/> === Description === Returns the bitwise ''negation'' of x. <source lang="lua"> (number) = bit...")
 
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Returns the bitwise ''negation'' of x.
 
Returns the bitwise ''negation'' of x.
<source 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:
<source 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