about summary refs log tree commit homepage
path: root/ext
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-04-08 14:36:36 -0700
committerEric Wong <normalperson@yhbt.net>2010-04-08 14:57:52 -0700
commit31925d90c3d292d0b5f20524082b7d3dc2e08fcb (patch)
treee23c2d927b3eba08dc107adf9aaba85a75ffe424 /ext
parent724c1f6a3b42a020199554c809a46ddc4b404659 (diff)
downloadclogger-31925d90c3d292d0b5f20524082b7d3dc2e08fcb.tar.gz
They're slightly faster when we know a number is small enough
to be a FIXNUM.
Diffstat (limited to 'ext')
-rw-r--r--ext/clogger_ext/clogger.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/clogger_ext/clogger.c b/ext/clogger_ext/clogger.c
index 6e14938..f0087fe 100644
--- a/ext/clogger_ext/clogger.c
+++ b/ext/clogger_ext/clogger.c
@@ -284,7 +284,7 @@ static void append_status(struct clogger *c)
                 }
         }
 
-        nr = NUM2INT(status);
+        nr = FIX2INT(status);
         if (nr >= 100 && nr <= 999) {
                 nr = snprintf(buf, sizeof(buf), "%03d", nr);
                 assert(nr == 3);
@@ -522,7 +522,7 @@ static VALUE cwrite(struct clogger *c)
 
         for (; --i >= 0; ary++) {
                 const VALUE *op = RARRAY_PTR(*ary);
-                enum clogger_opcode opcode = NUM2INT(op[0]);
+                enum clogger_opcode opcode = FIX2INT(op[0]);
 
                 switch (opcode) {
                 case CL_OP_LITERAL:
@@ -535,7 +535,7 @@ static VALUE cwrite(struct clogger *c)
                         append_response(c, op[1]);
                         break;
                 case CL_OP_SPECIAL:
-                        special_var(c, NUM2INT(op[1]));
+                        special_var(c, FIX2INT(op[1]));
                         break;
                 case CL_OP_EVAL:
                         append_eval(c, op[1]);
@@ -708,7 +708,7 @@ static VALUE ccall(struct clogger *c, VALUE env)
                         rb_ary_store(rv, 1, c->headers);
                 }
         } else {
-                c->status = INT2NUM(500);
+                c->status = INT2FIX(500);
                 c->headers = c->body = rb_ary_new();
                 cwrite(c);
                 rb_raise(rb_eTypeError,