<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_pack.rb, branch v4.0.4</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Revert pack/unpack support for LEB128</title>
<updated>2025-12-20T07:59:51+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2025-12-20T07:12:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=77c3a9e447ec477be39e00072e1ce3348d0f4533'/>
<id>77c3a9e447ec477be39e00072e1ce3348d0f4533</id>
<content type='text'>
https://bugs.ruby-lang.org/issues/21785#note-10
&gt; It is too late to introduce it in Ruby 4.0, let's aim for 4.1.

This reverts commits:

* d0b72429a93e54f1f956b4aedfc25c57dc7001aa
  Add support for signed and unsigned LEB128 to pack/unpack.

* 68a900e30b4ca1537d7975c3a619fd94fca7b084
  add news for pack / unpack directives
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://bugs.ruby-lang.org/issues/21785#note-10
&gt; It is too late to introduce it in Ruby 4.0, let's aim for 4.1.

This reverts commits:

* d0b72429a93e54f1f956b4aedfc25c57dc7001aa
  Add support for signed and unsigned LEB128 to pack/unpack.

* 68a900e30b4ca1537d7975c3a619fd94fca7b084
  add news for pack / unpack directives
</pre>
</div>
</content>
</entry>
<entry>
<title>Add support for signed and unsigned LEB128 to pack/unpack.</title>
<updated>2025-12-18T22:42:47+00:00</updated>
<author>
<name>Aaron Patterson</name>
<email>tenderlove@ruby-lang.org</email>
</author>
<published>2025-12-16T17:10:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d0b72429a93e54f1f956b4aedfc25c57dc7001aa'/>
<id>d0b72429a93e54f1f956b4aedfc25c57dc7001aa</id>
<content type='text'>
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, MQTT,
and Protobuf.

[Feature #21785]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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, MQTT,
and Protobuf.

[Feature #21785]
</pre>
</div>
</content>
</entry>
<entry>
<title>Expand opt_newarray_send to support Array#pack with buffer keyword arg</title>
<updated>2024-07-29T20:26:58+00:00</updated>
<author>
<name>Randy Stauner</name>
<email>randy.stauner@shopify.com</email>
</author>
<published>2024-07-20T17:03:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=acbb8d4fb56ac3b5894991760a075dbef78d10e3'/>
<id>acbb8d4fb56ac3b5894991760a075dbef78d10e3</id>
<content type='text'>
Use an enum for the method arg instead of needing to add an id
that doesn't map to an actual method name.

$ ruby --dump=insns -e 'b = "x"; [v].pack("E*", buffer: b)'

before:

```
== disasm: #&lt;ISeq:&lt;main&gt;@-e:1 (1,0)-(1,34)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] b@0
0000 putchilledstring                       "x"                       (   1)[Li]
0002 setlocal_WC_0                          b@0
0004 putself
0005 opt_send_without_block                 &lt;calldata!mid:v, argc:0, FCALL|VCALL|ARGS_SIMPLE&gt;
0007 newarray                               1
0009 putchilledstring                       "E*"
0011 getlocal_WC_0                          b@0
0013 opt_send_without_block                 &lt;calldata!mid:pack, argc:2, kw:[#&lt;Symbol:0x000000000023110c&gt;], KWARG&gt;
0015 leave
```

after:

```
== disasm: #&lt;ISeq:&lt;main&gt;@-e:1 (1,0)-(1,34)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] b@0
0000 putchilledstring                       "x"                       (   1)[Li]
0002 setlocal_WC_0                          b@0
0004 putself
0005 opt_send_without_block                 &lt;calldata!mid:v, argc:0, FCALL|VCALL|ARGS_SIMPLE&gt;
0007 putchilledstring                       "E*"
0009 getlocal                               b@0, 0
0012 opt_newarray_send                      3, 5
0015 leave
```
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use an enum for the method arg instead of needing to add an id
that doesn't map to an actual method name.

$ ruby --dump=insns -e 'b = "x"; [v].pack("E*", buffer: b)'

before:

```
== disasm: #&lt;ISeq:&lt;main&gt;@-e:1 (1,0)-(1,34)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] b@0
0000 putchilledstring                       "x"                       (   1)[Li]
0002 setlocal_WC_0                          b@0
0004 putself
0005 opt_send_without_block                 &lt;calldata!mid:v, argc:0, FCALL|VCALL|ARGS_SIMPLE&gt;
0007 newarray                               1
0009 putchilledstring                       "E*"
0011 getlocal_WC_0                          b@0
0013 opt_send_without_block                 &lt;calldata!mid:pack, argc:2, kw:[#&lt;Symbol:0x000000000023110c&gt;], KWARG&gt;
0015 leave
```

after:

```
== disasm: #&lt;ISeq:&lt;main&gt;@-e:1 (1,0)-(1,34)&gt;
local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 1] b@0
0000 putchilledstring                       "x"                       (   1)[Li]
0002 setlocal_WC_0                          b@0
0004 putself
0005 opt_send_without_block                 &lt;calldata!mid:v, argc:0, FCALL|VCALL|ARGS_SIMPLE&gt;
0007 putchilledstring                       "E*"
0009 getlocal                               b@0, 0
0012 opt_newarray_send                      3, 5
0015 leave
```
</pre>
</div>
</content>
</entry>
<entry>
<title>Introduce a specialize instruction for Array#pack</title>
<updated>2024-05-23T19:11:50+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-05-23T18:23:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=49fcd33e136ee2fe8720183b63a41bb6ef8d615c'/>
<id>49fcd33e136ee2fe8720183b63a41bb6ef8d615c</id>
<content type='text'>
Instructions for this code:

```ruby
  # frozen_string_literal: true

[a].pack("C")
```

Before this commit:

```
== disasm: #&lt;ISeq:&lt;main&gt;@test.rb:1 (1,0)-(3,13)&gt;
0000 putself                                                          (   3)[Li]
0001 opt_send_without_block                 &lt;calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE&gt;
0003 newarray                               1
0005 putobject                              "C"
0007 opt_send_without_block                 &lt;calldata!mid:pack, argc:1, ARGS_SIMPLE&gt;
0009 leave
```

After this commit:

```
== disasm: #&lt;ISeq:&lt;main&gt;@test.rb:1 (1,0)-(3,13)&gt;
0000 putself                                                          (   3)[Li]
0001 opt_send_without_block                 &lt;calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE&gt;
0003 putobject                              "C"
0005 opt_newarray_send                      2, :pack
0008 leave
```

Co-authored-by: Maxime Chevalier-Boisvert &lt;maxime.chevalierboisvert@shopify.com&gt;
Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instructions for this code:

```ruby
  # frozen_string_literal: true

[a].pack("C")
```

Before this commit:

```
== disasm: #&lt;ISeq:&lt;main&gt;@test.rb:1 (1,0)-(3,13)&gt;
0000 putself                                                          (   3)[Li]
0001 opt_send_without_block                 &lt;calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE&gt;
0003 newarray                               1
0005 putobject                              "C"
0007 opt_send_without_block                 &lt;calldata!mid:pack, argc:1, ARGS_SIMPLE&gt;
0009 leave
```

After this commit:

```
== disasm: #&lt;ISeq:&lt;main&gt;@test.rb:1 (1,0)-(3,13)&gt;
0000 putself                                                          (   3)[Li]
0001 opt_send_without_block                 &lt;calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE&gt;
0003 putobject                              "C"
0005 opt_newarray_send                      2, :pack
0008 leave
```

Co-authored-by: Maxime Chevalier-Boisvert &lt;maxime.chevalierboisvert@shopify.com&gt;
Co-authored-by: Aaron Patterson &lt;tenderlove@ruby-lang.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use size of `uintptr_t` for `j` and `J` tests</title>
<updated>2023-10-06T07:33:44+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-10-06T04:53:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b459bca0a62931143420db30e9ba5540cde48372'/>
<id>b459bca0a62931143420db30e9ba5540cde48372</id>
<content type='text'>
`RbConfig::SIZEOF` has been added later than the time this check was
committed first.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`RbConfig::SIZEOF` has been added later than the time this check was
committed first.
</pre>
</div>
</content>
</entry>
<entry>
<title>Move rbconfig to the top</title>
<updated>2023-10-06T07:33:44+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-10-06T04:48:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0202ca7cfc13866b603f5e093145ef80ac4728db'/>
<id>0202ca7cfc13866b603f5e093145ef80ac4728db</id>
<content type='text'>
It is required in the always defined class level.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is required in the always defined class level.
</pre>
</div>
</content>
</entry>
<entry>
<title>Raise an ArgumentError for unknown pack/unpack directive</title>
<updated>2023-01-05T18:05:03+00:00</updated>
<author>
<name>Benoit Daloze</name>
<email>eregontp@gmail.com</email>
</author>
<published>2023-01-05T17:41:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=03dd37775afb40eef392ae2920d728235af302c8'/>
<id>03dd37775afb40eef392ae2920d728235af302c8</id>
<content type='text'>
* [Bug #19150]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* [Bug #19150]
</pre>
</div>
</content>
</entry>
<entry>
<title>Unconditionally warn "unknown pack/unpack directive"</title>
<updated>2022-12-16T11:15:50+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2022-12-15T19:04:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ee7a338d2b21a84d194015c3680bd2a95c0dd23f'/>
<id>ee7a338d2b21a84d194015c3680bd2a95c0dd23f</id>
<content type='text'>
[Bug #19150]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #19150]
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #19108] Check for the encoding of pack/unpack format</title>
<updated>2022-12-01T08:38:33+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-11-22T05:25:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9869bd1d612b489df806cf95bcb56965a02424e0'/>
<id>9869bd1d612b489df806cf95bcb56965a02424e0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Use dedicated assertions for warnings</title>
<updated>2022-11-22T05:07:21+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-11-22T05:07:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8c02084ac8412dc57367ac1282cf5ab07554c94c'/>
<id>8c02084ac8412dc57367ac1282cf5ab07554c94c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
