General

Profile

tenderlovemaking (Aaron Patterson)

  • Login: tenderlovemaking
  • Email: [email protected]
  • Registered on: 07/09/2008
  • Last sign in: 12/19/2025

Issues

open closed Total
Assigned issues 31 248 279
Reported issues 31 131 162

Projects

Project Roles Registered on
Ruby Committer 11/13/2009

Activity

12/19/2025

05:22 PM Ruby Feature #21796: unpack variant that returns the final offset
I really like this idea. @jhawthorn suggested `^` instead of `o` though, and I really like it.
```ruby
bytes = "\x01\x02\x03"
offset = 0
leb128_value1, offset = bytes.unpack("R^", offset: offset) #=> 1
leb128_value2, offset = byt...
tenderlovemaking (Aaron Patterson)
01:57 AM Ruby Revision 68a900e3 (git): add news for pack / unpack directives
tenderlovemaking (Aaron Patterson)

12/18/2025

10:43 PM Ruby Feature #21785 (Closed): Add signed and unsigned LEB128 support to pack / unpack
Applied in changeset commit:git|d0b72429a93e54f1f956b4aedfc25c57dc7001aa.
----------
Add support for signed and unsigned LEB128 to pack/unpack.
This commit adds a new pack format command `R` and `r` for unsigned and
signed LEB128 encod...
tenderlovemaking (Aaron Patterson)
05:24 PM Ruby Feature #21785: Add signed and unsigned LEB128 support to pack / unpack
mame (Yusuke Endoh) wrote in #note-6:
> That apparoach is unreliable because LEB128 is redundant. For example, both `"\x03"` and `"\x83\x00"` are valid LEB128 encodings of the value 3.
Ah of course. I didn't think about that. 🤦‍♀️
tenderlovemaking (Aaron Patterson)
10:42 PM Ruby Revision d0b72429 (git): Add support for signed and unsigned LEB128 to pack/unpack.
This commit adds a new pack format command `R` and `r` for unsigned and
signed LEB128 encoding. The "r" mnemonic is because this is a
"vaRiable" length encoding scheme.
LEB128 is used in various formats including DWARF, WebAssembly, MQ...
tenderlovemaking (Aaron Patterson)

12/17/2025

10:26 PM Ruby Feature #21785: Add signed and unsigned LEB128 support to pack / unpack
mame (Yusuke Endoh) wrote in #note-4:
> It's a shame `unpack` doesn't tell you how many bytes it read. You'd probably want a `unpack` variant that returns the final offset too, or a specifier that returns the current offset (like `o`?)....
tenderlovemaking (Aaron Patterson)
03:08 AM Ruby Feature #21785: Add signed and unsigned LEB128 support to pack / unpack
matz (Yukihiro Matsumoto) wrote in #note-2:
> I am positive about the addition of LEB128. But I don't really like K/k because it doesn't remind me of LEB128 at all (though I know we've used L, E, B already).
> ...
Thanks for the feedba...
tenderlovemaking (Aaron Patterson)

12/16/2025

09:46 PM Ruby Feature #21785: Add signed and unsigned LEB128 support to pack / unpack
Sorry, I probably should have put an example in the original post. Here is a sample of the usage:
```
irb(main):003> [0xFFF].pack("K")
=> "\xFF\x1F"
irb(main):004> [0xFFF].pack("K").unpack1("K")
=> 4095
irb(main):005> [-123].pac...
tenderlovemaking (Aaron Patterson)
07:59 PM Ruby Feature #21785 (Closed): Add signed and unsigned LEB128 support to pack / unpack
Hi,
I'd like to add signed and unsigned LEB128 support to the pack and unpack methods. LEB128 is a variable length encoding scheme for integers. You can read the wikipedia entry about it here: https://en.wikipedia.org/wiki/LEB128
...
tenderlovemaking (Aaron Patterson)
05:44 PM Ruby Revision a8ba2b29 (git): add 21254 to the feature list
tenderlovemaking (Aaron Patterson)

Also available in: Atom