Skip to content

Commit 65238c6

Browse files
committed
Rubinius doesn't have rb_big_and
1 parent 11d17f0 commit 65238c6

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

ext/mysql2/extconf.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def asplode(lib)
2323
have_func('rb_wait_for_single_fd')
2424
have_func('rb_hash_dup')
2525
have_func('rb_intern3')
26+
have_func('rb_big_cmp')
2627

2728
# borrowed from mysqlplus
2829
# http://github.com/oldmoe/mysqlplus/blob/master/ext/extconf.rb

ext/mysql2/statement.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,14 @@ static int my_big2ll(VALUE bignum, LONG_LONG *ptr)
224224
}
225225
else {
226226
if (len == 8 && nlz_bits == 0 &&
227-
rb_big_and(bignum, LL2NUM(LLONG_MAX>>1)) != INT2FIX(0))
227+
#ifdef HAVE_RB_BIG_AND
228+
rb_big_and(bignum, LL2NUM(LLONG_MAX>>1)) != INT2FIX(0)
229+
#else
230+
rb_big_cmp(bignum, LL2NUM(LLONG_MIN)) == INT2FIX(-1)
231+
#endif
232+
) {
228233
goto overflow;
234+
}
229235
*ptr = rb_big2ll(bignum);
230236
}
231237
return 0;

0 commit comments

Comments
 (0)