backports 3.6.5 → 3.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/backports/2.1.0/bignum/bit_length.rb +5 -4
- data/lib/backports/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 964d3183e3d333b83e89a5179b5631c477ad2877
|
4
|
+
data.tar.gz: 624cba3d3ace5ed41c807ec5dce9855c626381cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57d45ac6182ccfa7c8d34965be85e0aba0ccc66a16e0a190f971915160637c1d1d73e7d138b999eb1cbea67f31dc7242fd11b6631f96dd2fd8639468308d322d
|
7
|
+
data.tar.gz: a22818b52c666515da59cc37b5ef2fcbf8dcba4ab2be044c64d486113574cb3ac6fc041404f305a5ae7d9592b77ad19f5f3d1058ad11902f812af6d4c4b7c6af
|
data/Gemfile.lock
CHANGED
@@ -2,16 +2,17 @@ unless Bignum.method_defined? :bit_length
|
|
2
2
|
require 'backports/2.0.0/range/bsearch'
|
3
3
|
class Bignum
|
4
4
|
def bit_length
|
5
|
-
# We use the fact that bignums use the minimum number of
|
6
|
-
#
|
7
|
-
|
5
|
+
# We use the fact that bignums use the minimum number of "words" necessary
|
6
|
+
# where "words" is some number of bytes <= to the size of a fixnum
|
7
|
+
# So we have (size - word_size) * 8 < bit_length <= size * 8
|
8
|
+
n = 8 * (size - 42.size)
|
8
9
|
smaller = self >> n
|
9
10
|
if smaller >= 0
|
10
11
|
smaller += 1
|
11
12
|
else
|
12
13
|
smaller = -smaller
|
13
14
|
end
|
14
|
-
n + (1..8).bsearch{|i| smaller <= (1 << i) }
|
15
|
+
n + (1..8 * 42.size).bsearch{|i| smaller <= (1 << i) }
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
data/lib/backports/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.6.
|
4
|
+
version: 3.6.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc-André Lafortune
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Essential backports that enable many of the nice features of Ruby 1.8.7
|
14
14
|
up to 2.1.0 for earlier versions.
|