Skip to content

Module: Bitwise

albion edited this page Jun 6, 2025 · 2 revisions

Important

Documentation has moved to the docs. This wiki will no longer be updated, and may be deleted in the future.

local Bitwise = require("Starlit/utils/Bitwise")

The Bitwise module defines some bitwise operations helper functions. These are generally faster than other implementations I've come across.

Functions

Bitwise.get(int: integer, pos: integer) -> bit: boolean

Checks the value of a single bit within an integer. pos is the position of the bit, counting from the right, starting with 1.


Bitwise.set(int: integer, pos: integer, value: boolean) -> int: integer

Returns the passed integer int modified with the specified bit changed. pos is the position of the bit, counting from the right, starting with 1.

Clone this wiki locally