Skip to content

Instantly share code, notes, and snippets.

@ferrous26
Last active December 10, 2015 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferrous26/4441215 to your computer and use it in GitHub Desktop.
Save ferrous26/4441215 to your computer and use it in GitHub Desktop.
MacRuby/MacRuby GH-174
diff --git a/time.c b/time.c
index 332aad9..730d0e5 100644
--- a/time.c
+++ b/time.c
@@ -10,6 +10,7 @@
#include "macruby_internal.h"
#include "ruby/node.h"
+#include "id.h"
#include "vm.h"
#include "objc.h"
#include "encoding.h"
@@ -30,7 +31,7 @@
static SEL sel_to_r, sel_divmod;
static ID id_divmod, id_mul, id_submicro, id_nano_num, id_nano_den, id_offset;
-static ID id_eq, id_ne, id_quo, id_div, id_cmp, id_lshift;
+static ID id_eq, id_ne, id_quo, id_div, id_lshift;
#define NDIV(x,y) (-(-((x)+1)/(y))-1)
#define NMOD(x,y) ((y)-(-((x)+1)%(y))-1)
@@ -56,7 +57,7 @@ cmp(VALUE x, VALUE y)
return 1;
return 0;
}
- return rb_cmpint(rb_funcall(x, id_cmp, 1, y), x, y);
+ return rb_cmpint(rb_vm_check_call(x, selCmp, 1, &y), x, y);
}
#define ne(x,y) (!eq((x),(y)))
@@ -430,7 +431,7 @@ wcmp(wideval_t wx, wideval_t wy)
#endif
x = w2v(wx);
y = w2v(wy);
- return rb_cmpint(rb_funcall(x, id_cmp, 1, y), x, y);
+ return rb_cmpint(rb_vm_check_call(x, selCmp, 1, &y), x, y);
}
#define wne(x,y) (!weq((x),(y)))
@@ -4777,7 +4778,6 @@ Init_Time(void)
id_ne = rb_intern("!=");
id_quo = rb_intern("quo");
id_div = rb_intern("div");
- id_cmp = rb_intern("<=>");
id_lshift = rb_intern("<<");
id_divmod = rb_intern("divmod");
id_mul = rb_intern("*");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment