ext/template/google_hash.cpp.erb in google_hash-0.8.4 vs ext/template/google_hash.cpp.erb in google_hash-0.8.5

- old
+ new

@@ -103,11 +103,17 @@ return RTEST(rb_funcall(s1, id_eql, 1, s2)); } }; #ifndef RBIGNUM_DIGITS -# define RBIGNUM_DIGITS(a) RBIGNUM(a)->digits + +# ifdef RBIGNUM + /* 1.8 'ish */ +# define RBIGNUM_DIGITS(a) RBIGNUM(a)->digits +# else + /* 2.2.0 has no way to do this? */ +# endif #endif struct hashrb { size_t operator()(VALUE hash_me) const @@ -127,27 +133,28 @@ case T_FIXNUM: case T_FLOAT: case T_SYMBOL: // ltodo return hash_me; - case T_BIGNUM: - return LONG2FIX(((long*)(RBIGNUM_DIGITS(hash_me)))[0]); // its first digit...I'm thinkin' - // not sure if this is faster or not... - //case T_STRING: + // we don't actually do bignums yet, though rb_big2int might help here... + // case T_BIGNUM: + // return LONG2FIX(((long*)(RBIGNUM_DIGITS(hash_me)))[0]); // its first digit...I'm thinkin' + // not sure if this is faster or not... + //case T_STRING: //return H(StringValueCStr(hash_me)); // populate/lookup 0.26 -> 0.23 [core is 0.16 somehow] // perhaps they cache? //return H(RSTRING_PTR(hash_me)); // 0.23 -> -.22 - } + } VALUE hval = rb_funcall(hash_me, id_hash, 0); retry: switch (TYPE(hval)) { case T_FIXNUM: return hval; - case T_BIGNUM: - return LONG2FIX(((long*)(RBIGNUM_DIGITS(hval)))[0]); + //??case T_BIGNUM: + //?? return LONG2FIX(((long*)(RBIGNUM_DIGITS(hval)))[0]); default: hval = rb_to_int(hval); goto retry; } } @@ -177,10 +184,10 @@ } <% end %> } static void free_hash_callback(RCallback* cb) { - delete cb->hash_map; // I had this line commented out one? huh? + delete cb->hash_map; // I had this line commented out once? huh? } static VALUE callback_alloc( VALUE klass ) {