Update to ruby/mspec@6499325
This commit is contained in:
parent
35bf660337
commit
9bc63e7ba0
@ -53,17 +53,28 @@ class PlatformGuard < SpecGuard
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# In bits
|
||||||
|
WORD_SIZE = 1.size * 8
|
||||||
|
deprecate_constant :WORD_SIZE
|
||||||
|
|
||||||
|
# In bits
|
||||||
POINTER_SIZE = begin
|
POINTER_SIZE = begin
|
||||||
require 'rbconfig/sizeof'
|
require 'rbconfig/sizeof'
|
||||||
RbConfig::SIZEOF["void*"] * 8
|
RbConfig::SIZEOF["void*"] * 8
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
[0].pack('j').size
|
[0].pack('j').size * 8
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# In bits
|
||||||
C_LONG_SIZE = if defined?(RbConfig::SIZEOF[])
|
C_LONG_SIZE = if defined?(RbConfig::SIZEOF[])
|
||||||
RbConfig::SIZEOF["long"] * 8
|
RbConfig::SIZEOF["long"] * 8
|
||||||
else
|
else
|
||||||
[0].pack('l!').size
|
[0].pack('l!').size * 8
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.wordsize?(size)
|
||||||
|
warn "#wordsize? is deprecated, use #c_long_size?"
|
||||||
|
size == WORD_SIZE
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.pointer_size?(size)
|
def self.pointer_size?(size)
|
||||||
@ -91,6 +102,9 @@ class PlatformGuard < SpecGuard
|
|||||||
match &&= PlatformGuard.os?(*value)
|
match &&= PlatformGuard.os?(*value)
|
||||||
when :pointer_size
|
when :pointer_size
|
||||||
match &&= PlatformGuard.pointer_size? value
|
match &&= PlatformGuard.pointer_size? value
|
||||||
|
when :wordsize
|
||||||
|
warn ":wordsize is deprecated, use :c_long_size"
|
||||||
|
match &&= PlatformGuard.wordsize? value
|
||||||
when :c_long_size
|
when :c_long_size
|
||||||
match &&= PlatformGuard::c_long_size? value
|
match &&= PlatformGuard::c_long_size? value
|
||||||
end
|
end
|
||||||
|
@ -16,13 +16,11 @@ def bignum_value(plus = 0)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def max_long
|
def max_long
|
||||||
long_byte_size = [0].pack('l!').size
|
2**(PlatformGuard::C_LONG_SIZE - 1) - 1
|
||||||
2**(long_byte_size * 8 - 1) - 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def min_long
|
def min_long
|
||||||
long_byte_size = [0].pack('l!').size
|
-(2**(PlatformGuard::C_LONG_SIZE - 1))
|
||||||
-(2**(long_byte_size * 8 - 1))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# This is a bit hairy, but we need to be able to write specs that cover the
|
# This is a bit hairy, but we need to be able to write specs that cover the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user