Update to ruby/mspec@6499325
This commit is contained in:
parent
35bf660337
commit
9bc63e7ba0
@ -53,17 +53,28 @@ class PlatformGuard < SpecGuard
|
||||
end
|
||||
end
|
||||
|
||||
# In bits
|
||||
WORD_SIZE = 1.size * 8
|
||||
deprecate_constant :WORD_SIZE
|
||||
|
||||
# In bits
|
||||
POINTER_SIZE = begin
|
||||
require 'rbconfig/sizeof'
|
||||
RbConfig::SIZEOF["void*"] * 8
|
||||
rescue LoadError
|
||||
[0].pack('j').size
|
||||
[0].pack('j').size * 8
|
||||
end
|
||||
|
||||
# In bits
|
||||
C_LONG_SIZE = if defined?(RbConfig::SIZEOF[])
|
||||
RbConfig::SIZEOF["long"] * 8
|
||||
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
|
||||
|
||||
def self.pointer_size?(size)
|
||||
@ -91,6 +102,9 @@ class PlatformGuard < SpecGuard
|
||||
match &&= PlatformGuard.os?(*value)
|
||||
when :pointer_size
|
||||
match &&= PlatformGuard.pointer_size? value
|
||||
when :wordsize
|
||||
warn ":wordsize is deprecated, use :c_long_size"
|
||||
match &&= PlatformGuard.wordsize? value
|
||||
when :c_long_size
|
||||
match &&= PlatformGuard::c_long_size? value
|
||||
end
|
||||
|
@ -16,13 +16,11 @@ def bignum_value(plus = 0)
|
||||
end
|
||||
|
||||
def max_long
|
||||
long_byte_size = [0].pack('l!').size
|
||||
2**(long_byte_size * 8 - 1) - 1
|
||||
2**(PlatformGuard::C_LONG_SIZE - 1) - 1
|
||||
end
|
||||
|
||||
def min_long
|
||||
long_byte_size = [0].pack('l!').size
|
||||
-(2**(long_byte_size * 8 - 1))
|
||||
-(2**(PlatformGuard::C_LONG_SIZE - 1))
|
||||
end
|
||||
|
||||
# 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