backports 3.6.5 → 3.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9aa6079dcd8824dcc4ed7d89341ba81ae14ee1f2
4
- data.tar.gz: 25c6fa54364e18de597fadf27de457c591ce6d17
3
+ metadata.gz: 964d3183e3d333b83e89a5179b5631c477ad2877
4
+ data.tar.gz: 624cba3d3ace5ed41c807ec5dce9855c626381cf
5
5
  SHA512:
6
- metadata.gz: 4e5c84c312e0716a1283d93277d04ee8de3d62527c95eb5fa83a7a7c6b99ba05a832df0d696675597a502b8b41b63a01423af484b1f2ca135a9654ab0f54db85
7
- data.tar.gz: 688e1bd667a6e5486e1e11a681e5e18b8004396af20c56c6b1e5a1c5258710b5a5b2562afd514e287b9eec7d8ba9ea104e21e9775984a02dd3829a3403ebb618
6
+ metadata.gz: 57d45ac6182ccfa7c8d34965be85e0aba0ccc66a16e0a190f971915160637c1d1d73e7d138b999eb1cbea67f31dc7242fd11b6631f96dd2fd8639468308d322d
7
+ data.tar.gz: a22818b52c666515da59cc37b5ef2fcbf8dcba4ab2be044c64d486113574cb3ac6fc041404f305a5ae7d9592b77ad19f5f3d1058ad11902f812af6d4c4b7c6af
data/Gemfile.lock CHANGED
@@ -7,7 +7,7 @@ GIT
7
7
  PATH
8
8
  remote: .
9
9
  specs:
10
- backports (3.6.5)
10
+ backports (3.6.6)
11
11
 
12
12
  GEM
13
13
  remote: http://rubygems.org/
@@ -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 bytes necessary
6
- # So we have (size - 1) * 8 < bit_length <= size * 8
7
- n = 8 * (size - 1)
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
@@ -1,3 +1,3 @@
1
1
  module Backports
2
- VERSION = "3.6.5" unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
2
+ VERSION = "3.6.6" unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
3
3
  end
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.5
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-07-13 00:00:00.000000000 Z
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.