Skip to content

Instantly share code, notes, and snippets.

@nobu
Created July 2, 2009 00:31
Show Gist options
  • Save nobu/139204 to your computer and use it in GitHub Desktop.
Save nobu/139204 to your computer and use it in GitHub Desktop.
Index: ext/decimal/decimal.c
===================================================================
--- ext/decimal/decimal.c (revision 78)
+++ ext/decimal/decimal.c (working copy)
@@ -16,9 +16,9 @@
#include <string.h>
+#include <ruby.h>
#ifdef HAVE_RUBY_RUBY_H
#include <ruby/ruby.h>
#include <ruby/util.h>
#else
-#include <ruby.h>
#include <rubysig.h>
#include <util.h>
@@ -993,5 +993,4 @@ dec_divide(int argc, VALUE *argv, VALUE
}
-#ifdef DEBUG
/* :nodoc: */
static VALUE
@@ -1000,5 +999,4 @@ dec_div(VALUE x, VALUE y)
return dec_divide(1, &y, x);
}
-#endif
/*
@@ -1053,6 +1051,6 @@ divmod(Decimal *a, Decimal *b, VALUE *di
}
/* if ((mod < 0 && y > 0) || (mod > 0 && y < 0)) { */
- if (INUM_NEGATIVE_P(mod->inum) != INUM_NEGATIVE_P(b->inum) &&
- !INUM_SPZERO_P(mod->inum) && !INUM_SPZERO_P(b->inum)) {
+ if (!INUM_SPZERO_P(mod->inum) && !INUM_SPZERO_P(b->inum) &&
+ INUM_NEGATIVE_P(mod->inum) != INUM_NEGATIVE_P(b->inum)) {
mod = normal_plus(mod, b, Qtrue); /* mod += y; */
INUM_DEC(div->inum); /* div -= 1; */
@@ -1911,7 +1909,5 @@ Init_decimal(void)
rb_define_method(cDecimal, "*", dec_mul, 1);
rb_define_method(cDecimal, "divide", dec_divide, -1);
-#ifdef DEBUG
rb_define_method(cDecimal, "/", dec_div, 1);
-#endif
rb_define_method(cDecimal, "div", dec_idiv, 1);
rb_define_method(cDecimal, "%", dec_mod, 1);
Index: ext/decimal/extconf.rb
===================================================================
--- ext/decimal/extconf.rb (revision 78)
+++ ext/decimal/extconf.rb (working copy)
@@ -2,5 +2,4 @@ require "mkmf"
(cflags = arg_config("--cflags")) && $CFLAGS << " #{cflags}"
-have_header "ruby/ruby.h"
have_func "rb_big_div"
have_func "rb_big_modulo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment