-
Notifications
You must be signed in to change notification settings - Fork 43
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
RFC: buffer.readbits/writebits #18
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump, this would be extremely helpful.
Yeah, it took a while in the pipeline with other priorities, but we still remember about this one and it's likely to be accepted. |
This has a typo (
Will take 17 least-significant bits of ... There's probably a cleaner way to describe this but at least one example of boundary straddling would be helpful. |
That is correct, in a code form example: local buf0 = buffer.create(16)
buffer.writebits(buf0, 5, 17, 0b11111111_11111111_11111111_11111111)
assert(buffer.readu8(buf0, 0) == 0b11100000)
assert(buffer.readu8(buf0, 1) == 0b11111111)
assert(buffer.readu8(buf0, 2) == 0b00111111)
local buf1 = buffer.create(16)
buffer.fill(buf1, 0, 0xff)
buffer.writebits(buf1, 5, 17, 0b00000000_00000000_00000000_00000000)
assert(buffer.readu8(buf1, 0) == 0b00011111)
assert(buffer.readu8(buf1, 1) == 0b00000000)
assert(buffer.readu8(buf1, 2) == 0b11000000) |
# General All code has been re-formatted by `clang-format`; this is not mechanically enforced, so Luau may go out-of-sync over the course of the year. # New Solver * Track free types interior to a block of code on `Scope`, which should reduce the number of free types that remain un-generalized after type checking is complete (e.g.: less errors like `'a <: number is incompatible with number`). # Autocomplete * Fragment autocomplete now does *not* provide suggestions within comments (matching non-fragment autocomplete behavior). * Autocomplete now respects iteration and recursion limits (some hangs will now early exit with a "unification too complex error," some crashes will now become internal complier exceptions). # Runtime * Add a limit to how many Luau codegen slot nodes addresses can be in use at the same time (fixes #1605, fixes #1558). * Added constant folding for vector arithmetic (fixes #1553). * Added support for `buffer.readbits` and `buffer.writebits` (see: luau-lang/rfcs#18). --- Co-authored-by: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: David Cope <dcope@roblox.com> Co-authored-by: Hunter Goldstein <hgoldstein@roblox.com> Co-authored-by: Vighnesh Vijay <vvijay@roblox.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
Rendered: link