similie 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/ext/similie.c +10 -10
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -36,16 +36,16 @@
36
36
 
37
37
  // http://en.wikipedia.org/wiki/Hamming_weight
38
38
 
39
- const uint64 m1 = 0x5555555555555555; //binary: 0101...
40
- const uint64 m2 = 0x3333333333333333; //binary: 00110011..
41
- const uint64 m4 = 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ...
42
- const uint64 m8 = 0x00ff00ff00ff00ff; //binary: 8 zeros, 8 ones ...
43
- const uint64 m16 = 0x0000ffff0000ffff; //binary: 16 zeros, 16 ones ...
44
- const uint64 m32 = 0x00000000ffffffff; //binary: 32 zeros, 32 ones
45
- const uint64 hff = 0xffffffffffffffff; //binary: all ones
46
- const uint64 h01 = 0x0101010101010101; //the sum of 256 to the power of 0,1,2,3...
47
-
48
- int popcount(uint64 x) {
39
+ const uint64_t m1 = 0x5555555555555555; //binary: 0101...
40
+ const uint64_t m2 = 0x3333333333333333; //binary: 00110011..
41
+ const uint64_t m4 = 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ...
42
+ const uint64_t m8 = 0x00ff00ff00ff00ff; //binary: 8 zeros, 8 ones ...
43
+ const uint64_t m16 = 0x0000ffff0000ffff; //binary: 16 zeros, 16 ones ...
44
+ const uint64_t m32 = 0x00000000ffffffff; //binary: 32 zeros, 32 ones
45
+ const uint64_t hff = 0xffffffffffffffff; //binary: all ones
46
+ const uint64_t h01 = 0x0101010101010101; //the sum of 256 to the power of 0,1,2,3...
47
+
48
+ int popcount(uint64_t x) {
49
49
  x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
50
50
  x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
51
51
  x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bharanee Rathna