From 5194dcc12604237acf15d1647e8650d90808c3f7 Mon Sep 17 00:00:00 2001 From: Vyacheslav Egorov <vegorov@roblox.com> Date: Fri, 22 Dec 2023 22:22:04 -0800 Subject: [PATCH] Note about large offset --- docs/function-buffer-bits.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/function-buffer-bits.md b/docs/function-buffer-bits.md index 883a033..9bc3f1e 100644 --- a/docs/function-buffer-bits.md +++ b/docs/function-buffer-bits.md @@ -53,6 +53,8 @@ buffer.readi8(b, 0) == 3 Because of the bounds checking requirements, implementation needs a loop to access the buffer bytes, which is potentially slower than what developers can do with existing functions when they know that it's safe to read a larger number and extract bits with bit32 functions. +Because the max size of the buffer is 1GB, `bitOffset` cannot be handled as a 32-bit integer number like byte offset in other buffer functions. + ## Alternatives A signed version of `readbits` is not proposed to simplify the design. Writing and reading signed values can be performed with a bias.