diff options
| author | Alan Wu <XrXr@users.noreply.github.com> | 2024-07-23 18:14:45 -0400 |
|---|---|---|
| committer | Benoit Daloze <eregontp@gmail.com> | 2024-07-24 18:20:30 +0200 |
| commit | 12e6cf77efae6804063dbebe84e4080ca78958e7 (patch) | |
| tree | 010d5b0b824fb53722df576de43de8bd80d032cd /spec/ruby/core/array/pack/shared/integer.rb | |
| parent | 1a18b03ee7b14771eae9eafa3c85a6bf5ccd9502 (diff) | |
Add "c_long_size" guard, supplanting "wordsize" and stop using Integer#size
What a "word" is when talking about sizes is confusing because it's a
highly overloaded term. Intel, Microsoft, and GDB are just a few vendors
that have their own definition of what a "word" is. Specs that used the
"wordsize" guard actually were mostly testing for the size of the C
`long` fundamental type, so rename the guard for clarity.
Also, get the size of `long` directly from RbConfig instead of guessing
using Integer#size. Integer#size is not guaranteed to have anything to
do with the `long` type.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11130
Diffstat (limited to 'spec/ruby/core/array/pack/shared/integer.rb')
| -rw-r--r-- | spec/ruby/core/array/pack/shared/integer.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/ruby/core/array/pack/shared/integer.rb b/spec/ruby/core/array/pack/shared/integer.rb index fd21b25b19..a89b5b733b 100644 --- a/spec/ruby/core/array/pack/shared/integer.rb +++ b/spec/ruby/core/array/pack/shared/integer.rb @@ -273,7 +273,7 @@ describe :array_pack_32bit_le_platform, shared: true do str.should == "\x78\x65\x43\x12\xcd\xab\xf0\xde\x21\x43\x65\x78" end - platform_is wordsize: 64 do + platform_is c_long_size: 64 do it "encodes the least significant 32 bits of a number that is greater than 32 bits" do [ [[0xff_7865_4321], "\x21\x43\x65\x78"], [[-0xff_7865_4321], "\xdf\xbc\x9a\x87"] @@ -299,7 +299,7 @@ describe :array_pack_32bit_be_platform, shared: true do str.should == "\x12\x43\x65\x78\xde\xf0\xab\xcd\x78\x65\x43\x21" end - platform_is wordsize: 64 do + platform_is c_long_size: 64 do it "encodes the least significant 32 bits of a number that is greater than 32 bits" do [ [[0xff_7865_4321], "\x78\x65\x43\x21"], [[-0xff_7865_4321], "\x87\x9a\xbc\xdf"] |
