4 //#include "gstsparrow.h"
11 guint64 tests
[] = {0xf0f0f0f0f0f0f0f0, 0x0001111116000000,
12 0x123456789abcdef0, 0x0fedcba987654321,
13 0x0100, 0x77, 1, 2, 3};
15 for (i
= 0; i
< (sizeof(tests
) / sizeof(guint64
)); i
++){
16 guint32 r
= popcount64(tests
[i
]);
17 printf("%016llx -> %u\n", tests
[i
], r
);
22 test_hamming_distance64()
24 guint64 tests
[] = {0xf0f0f0f0f0f0f0f0, 0xf0f0f0f0f0f0f0f0, 0xffffffffffffffff,
25 0xf0f0f0f0f0f0f0f0, 0xffffffffffffffff, 0xffffffffffffffff,
26 0x0000000000000000, 0x0000000000000010, 0xffffffffffffffff,
27 0x1000000000000010, 0x0100000000000010, 0xffffffffffffffff,
28 0x1000000000000010, 0x0100000000000010, 0xffffffff00000000
31 for (i
= 0; i
< (sizeof(tests
) / sizeof(guint64
)); i
+= 3){
32 guint32 r
= hamming_distance64(tests
[i
], tests
[i
+ 1], tests
[i
+ 2]);
33 printf("%016llx, %016llx, mask %016llx -> %u\n", tests
[i
], tests
[i
+ 1], tests
[i
+ 2], r
);
41 test_hamming_distance64();