Your browser does not support HTML5 canvas. Fork me on GitHub

Available Packages:

Bitwise

Source

function int.and32(int other) returns int

Source

32-bit AND (&) number.and32(other) equivalent to (number & other)

function int.and8(int other) returns int

Source

8-bit AND (&) NOTE: Assumes both operands are in the range [0, 255] number.and8(other) equivalent to (number & other)

function int.byte1() returns int

Source

function int.byte2() returns int

Source

function int.byte3() returns int

Source

function byte4(int b1, int b2, int b3, int b4) returns byte4

Source

A tuple containing 4 bytes comprising a 4-byte integer. b1 is the least significant byte, b4 is the most significant byte. All functions operating on this are LSB first. The bytes are always unsigned, from 0 to 255. WARNING: This library contains no safety bound checks to guarantee that these bytes stay in the 0-255 range. If these values go out of bounds, the behaviour is undefined.

function int.byte4(int isNegative) returns int

Source

function int.bytes() returns byte4

Source

De-composes an integer into 4 unsigned bytes.

function string.fromBitString() returns int

Source

Produces a signed integer from the bitstring. Input string may contain whitespace for padding.

function int.not32() returns int

Source

32-bit NOT (~) number.not32() equivalent to (~number)

function int.not8() returns int

Source

8-bit NOT (~) NOTE: Assumes number is in the range [0, 255] number.not8() equivalent to (~number)

function int.or32(int other) returns int

Source

32-bit OR (|) number.or32(other) equivalent to (number | other)

function int.or8(int other) returns int

Source

8-bit OR (|) NOTE: Assumes both operands are in the range [0, 255] number.or8(other) equivalent to (number | other)

function byte4.put(int pos, int value) returns byte4

Source

Replaces the byte in the n-th position with the provided one.

function byte4.select(int pos) returns int

Source

Selects the n-th byte from these bytes, starting from 0 for the least significant byte and ending with 3 for the most significant byte.

function int.shiftl(int amount) returns int

Source

32-bit SHIFTL (<<) number.shiftl(amount) equivalent to (number << amount)

function int.shiftr(int amount) returns int

Source

32-bit SHIFTR (>>) number.shiftr(amount) equivalent to (number >> amount)

function int.toBitString() returns string

Source

Produces a bistring from this integer.

function byte4.toInt() returns int

Source

Re-assembles these bytes into an integer.

function int.toUnsigned() returns int

Source

Turns this signed integer into an unsigned one if it is negative, removing the first (sign) bit

function int.xor32(int other) returns int

Source

32-bit XOR (^) number.xor32(other) equivalent to (number ^ other)

function int.xor8(int other) returns int

Source

8-bit XOR (^) NOTE: Assumes both operands are in the range [0, 255] number.xor8(other) equivalent to (number ^ other)