nupp.runtime.bitops.spi

Implementation interfaces consumed during ordinary module initialization. Discover with nupp.spi.load; the consumer chooses the unique highest priority. Omitted priority is zero. Importing these declarations loads no implementation.

Module contents

Types

TypeKindDescription
Providerinterface32-bit operations with Lua BitOp semantics.

Types#

Providerinterface#

interface Provider ...

32-bit operations with Lua BitOp semantics.

Results are signed integers representing 32-bit words, including logical right shift results whose high bit is set. Inputs normalize to 32 bits; shifts and rotates mask counts to five bits. Variadic operations consume every operand. Providers must preserve these conventions even on hosts with unsigned primitives.

Members

NameKindDescription
priorityfield
tobitmethodNormalizes a numeric operand to a signed 32-bit word.
tohexmethodFormats the low requested hexadecimal digits; negative digits select uppercase.
rolmethodRotates left by the low five bits of count.
rormethodRotates right by the low five bits of count.
bswapmethodReverses the four bytes of the normalized word.
bandmethodBitwise conjunction of the first operand and every remaining operand.
bormethodBitwise disjunction of every operand.
bxormethodBitwise exclusive-or of every operand.
bnotmethodInverts all 32 bits.
lshiftmethodShifts left, discarding bits beyond the word.
rshiftmethodShifts right with zero fill, then returns the signed word representation.
arshiftmethodShifts right with sign extension.

priorityfield#

priority: integer?
@readonly

tobitmethod#

tobit: function(value: number): integer
@readonly

Normalizes a numeric operand to a signed 32-bit word.

Arguments
NameTypeDescription
valuenumber
Returns
TypeDescription
integer

tohexmethod#

tohex: function(value: number, digits: number?): string
@readonly

Formats the low requested hexadecimal digits; negative digits select uppercase.

Arguments
NameTypeDescription
valuenumber
digitsnumber?
Returns
TypeDescription
string

rolmethod#

rol: function(value: number, count: number): integer
@readonly

Rotates left by the low five bits of count.

Arguments
NameTypeDescription
valuenumber
countnumber
Returns
TypeDescription
integer

rormethod#

ror: function(value: number, count: number): integer
@readonly

Rotates right by the low five bits of count.

Arguments
NameTypeDescription
valuenumber
countnumber
Returns
TypeDescription
integer

bswapmethod#

bswap: function(value: number): integer
@readonly

Reverses the four bytes of the normalized word.

Arguments
NameTypeDescription
valuenumber
Returns
TypeDescription
integer

bandmethod#

band: function(first: number, ...: number): integer
@readonly

Bitwise conjunction of the first operand and every remaining operand.

Arguments
NameTypeDescription
firstnumber
...number
Returns
TypeDescription
integer

bormethod#

bor: function(first: number, ...: number): integer
@readonly

Bitwise disjunction of every operand.

Arguments
NameTypeDescription
firstnumber
...number
Returns
TypeDescription
integer

bxormethod#

bxor: function(first: number, ...: number): integer
@readonly

Bitwise exclusive-or of every operand.

Arguments
NameTypeDescription
firstnumber
...number
Returns
TypeDescription
integer

bnotmethod#

bnot: function(value: number): integer
@readonly

Inverts all 32 bits.

Arguments
NameTypeDescription
valuenumber
Returns
TypeDescription
integer

lshiftmethod#

lshift: function(value: number, count: number): integer
@readonly

Shifts left, discarding bits beyond the word.

Arguments
NameTypeDescription
valuenumber
countnumber
Returns
TypeDescription
integer

rshiftmethod#

rshift: function(value: number, count: number): integer
@readonly

Shifts right with zero fill, then returns the signed word representation.

Arguments
NameTypeDescription
valuenumber
countnumber
Returns
TypeDescription
integer

arshiftmethod#

arshift: function(value: number, count: number): integer
@readonly

Shifts right with sign extension.

Arguments
NameTypeDescription
valuenumber
countnumber
Returns
TypeDescription
integer