grayphash 0.0.4 → 0.0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/grayhash/grayphash.c +6 -6
- metadata +1 -1
data/ext/grayhash/grayphash.c
CHANGED
@@ -32,11 +32,11 @@ VALUE method_hamming(int argc, VALUE * argv, VALUE self) {
|
|
32
32
|
unsigned long long hash2 = rb_num2ull(argv[1]);
|
33
33
|
|
34
34
|
|
35
|
-
|
36
|
-
const
|
37
|
-
const
|
38
|
-
const
|
39
|
-
const
|
35
|
+
unsigned long long x = hash1^hash2;
|
36
|
+
const unsigned long long m1 = 0x5555555555555555ULL;
|
37
|
+
const unsigned long long m2 = 0x3333333333333333ULL;
|
38
|
+
const unsigned long long h01 = 0x0101010101010101ULL;
|
39
|
+
const unsigned long long m4 = 0x0f0f0f0f0f0f0f0fULL;
|
40
40
|
x -= (x >> 1) & m1;
|
41
41
|
x = (x & m2) + ((x >> 2) & m2);
|
42
42
|
x = (x + (x >> 4)) & m4;
|
@@ -65,7 +65,7 @@ VALUE method_close(VALUE self) {
|
|
65
65
|
}
|
66
66
|
|
67
67
|
VALUE method_about(VALUE self) {
|
68
|
-
return rb_str_new_cstr("pHash 0.9.4. Copyright 2008-2010 Aetilius, Inc. Included only some image functions (grayphash v-0.0.4).");
|
68
|
+
return rb_str_new_cstr("pHash 0.9.4. Copyright 2008-2010 Aetilius, Inc. Included only some image functions (grayphash v-0.0.4.1).");
|
69
69
|
//char* (*about)();
|
70
70
|
//about = dlsym(sdl_library, "ph_about");
|
71
71
|
|