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")
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>
 
</source>
  
 
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>
 
</source>

Revision as of 14:26, 13 July 2023

Available since: Gideros 2022.3
Class: bit32

Description

Returns the bitwise negation of x. <syntaxhighlight lang="lua"> (number) = bit32.bnot(x) </source>

For any integer x, the following identity holds: <syntaxhighlight lang="lua"> assert(bit32.bnot(x) == (-1 - x) % 2^32) </source>

Parameters

x: (number) value

Return values

Returns (number) result

See also

Bitwise Operators