I inserted the same input, but I got different bitmap on Linux and Mac.
I ran the following code.
require 'cbloomfilter'
bf = CBloomFilter.new(16, 1, 7, 1)
puts "m #{bf.m}"
puts "k #{bf.k}"
puts "b #{bf.b}"
bf.insert 'a'
puts "bitmap: #{bf}"
$ bundle exec ruby test.rb
m 16
k 1
b 1
bitmap: 1000000000000000
m 16
k 1
b 1
bitmap: 0000000000000100
I added rb_warn into crc32 to check if the function crc32 in your gem is called.
... snip ...
#include "crc32.h"
unsigned int crc32(unsigned int crc, char *buf, int len) {
while (len > 0) {
crc = crc_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
rb_warn("crc: %d\n", crc);
--len;
++buf;
}
return crc;
}
And I ran test.rb with bundler, but I got no warning output by rb_warn.
From this result, maybe crc32 in your gem is not called.
I also ran test.rb without bundler specifying LOAD_PATH explicitly.
$ ruby -I./vendor/bundle/ruby/2.2.0/bundler/gems/bloomfilter-rb-8c9da9516796/ext/cbloomfilter test.rb
m 16
k 1
b 1
test.rb:9: warning: crc: -1529756563
bitmap: 0000000000000100
The waning output came out and I got the same bitmap as that on Mac.
So crc32 seems to be overridden by another library when using bundler on Linux.
I inserted the same input, but I got different
bitmapon Linux and Mac.I ran the following code.
I added
rb_warnintocrc32to check if the functioncrc32in your gem is called.And I ran
test.rbwith bundler, but I got no warning output byrb_warn.From this result, maybe
crc32in your gem is not called.I also ran
test.rbwithout bundler specifyingLOAD_PATHexplicitly.The waning output came out and I got the same
bitmapas that on Mac.So
crc32seems to be overridden by another library when using bundler on Linux.