Issue #21785 has been updated by tenderlovemaking (Aaron Patterson). 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].pack("k") => "\x85\x7F" irb(main):006> [-123].pack("k").unpack1("k") => -123 ``` ---------------------------------------- Feature #21785: Add signed and unsigned LEB128 support to pack / unpack https://bugs.ruby-lang.org/issues/21785#change-115753 * Author: tenderlovemaking (Aaron Patterson) * Status: Open ---------------------------------------- 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 LEB128 is used in DWARF, WebAssembly, MQTT, and Protobuf. I'm sure there are other formats, but these are the ones I'm familiar with. I sent a pull request here: https://github.com/ruby/ruby/pull/15589 I'm proposing `K` for the unsigned version and `k` for the signed version. I just picked `k` because it was available, I'm open to other format strings. Thanks for consideration! -- https://bugs.ruby-lang.org/