Skip to content

Add readbits and writebits to buffer #1373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/roblox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2888,6 +2888,9 @@ declare namespace buffer {
/** Returns the size of the buffer in bytes. */
function len(b: buffer): number;

/** Reads a range of bits into an unsigned integer from the buffer based on a specific bitCount integer from 0 to 32, inclusive. */
function readbits(b: buffer, bitOffset: number, bitCount: number): number;

/** Reads an 8-bit signed integer from the buffer. */
function readi8(b: buffer, offset: number): number;

Expand Down Expand Up @@ -2915,6 +2918,9 @@ declare namespace buffer {
/** Writes an 8-bit signed integer to the buffer. */
function writei8(b: buffer, offset: number, value: number): void;

/** Writes data to the buffer based on a specific bitCount integer from 0 to 32, inclusive. `value` is treated as an unsigned 32‑bit number and only bitCount least significant bits are written. */
function writebits(b: buffer, bitOffset: number, bitCount: number, value: number): void;

/** Writes an 8-bit unsigned integer to the buffer. */
function writeu8(b: buffer, offset: number, value: number): void;

Expand Down