hyperll 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 078a9aafd86d9c1ffa575e83b0ed2826a5605afa
4
- data.tar.gz: 174892051165cea609a7b77476adb88afad2cd1a
3
+ metadata.gz: 641d27a87b64d8c4f0f00519c6936b2276b1ca43
4
+ data.tar.gz: 18fab0477ccba2f4e27ce9009d910339bc51c53a
5
5
  SHA512:
6
- metadata.gz: ac15ed412c66ab1bd72e7cc71c0ba57ba85ee410c333a3fc71e4e624d6b9046a3dccd106a86354245668400f492c8f09762bdbf9e902a63665568965f41f8771
7
- data.tar.gz: 003a2c5236fd3b94a02a5fa0d3dce615b04feb5ea2c04f21aa34663200d607196b0112fce34bf759f8c93323934938f5d1df46da5fc4eb3eda039c63a5fa8820
6
+ metadata.gz: e2d542b9b698fe943f48e83f0968c4cb66dda818170f0c2851a5746decca94252aa4b5c6103527f9411df929417ae583723ed648d96d119aa05250e200e1f9b7
7
+ data.tar.gz: d233ae38368376bc3dfdc8b49e7dea8aced87665eab2dd700338e24484a53c26eeb34bc136825210441a0244ec8fba9a6fd3cc31d6f785ea1ce8760310393ea6
@@ -5,6 +5,7 @@ module Hyperll
5
5
  LOG2_BITS_PER_WORD = 6
6
6
  REGISTER_SIZE = 5
7
7
  INTEGER_SIZE = 32
8
+ INT_MASK = 0xFFFFFFFF
8
9
 
9
10
  attr_reader :count, :size
10
11
 
@@ -27,7 +28,7 @@ module Hyperll
27
28
  bucket = position / LOG2_BITS_PER_WORD
28
29
  shift = REGISTER_SIZE * (position - (bucket * LOG2_BITS_PER_WORD))
29
30
 
30
- @values[bucket] = (@values[bucket] & ~(0x1f << shift)) | (value << shift)
31
+ @values[bucket] = ((@values[bucket] & ~(0x1f << shift)) | (value << shift)) & INT_MASK
31
32
  end
32
33
 
33
34
  def [](position)
@@ -47,12 +48,12 @@ module Hyperll
47
48
  def update_if_greater(position, value)
48
49
  bucket = position / LOG2_BITS_PER_WORD
49
50
  shift = REGISTER_SIZE * (position - (bucket * LOG2_BITS_PER_WORD));
50
- mask = 0x1f << shift;
51
+ mask = (0x1f << shift) & INT_MASK
51
52
 
52
53
  current_value = @values[bucket] & mask
53
54
  new_value = value << shift
54
55
  if current_value < new_value
55
- @values[bucket] = (@values[bucket] & ~mask) | new_value
56
+ @values[bucket] = ((@values[bucket] & ~mask) | new_value) & INT_MASK
56
57
  true
57
58
  else
58
59
  false
@@ -1,3 +1,3 @@
1
1
  module Hyperll
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperll
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Lindeman