From 6e0fed271c1d2e6f2b13b99d89d43e7d00e81472 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 2 Feb 2007 13:19:44 +0000 Subject: * ruby.h (SYMBOL_P): make Symbol immediate again for performance. * string.c: redesign symbol methods. * parse.y (rb_id2str): store Strings for operator symbols. [ruby-dev:30235] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ruby.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'ruby.h') diff --git a/ruby.h b/ruby.h index cf303f8e3c..e5b4a69697 100644 --- a/ruby.h +++ b/ruby.h @@ -197,11 +197,10 @@ VALUE rb_ull2inum(unsigned LONG_LONG); #define IMMEDIATE_MASK 0x03 #define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK) -#define SYMBOL_P(x) (!SPECIAL_CONST_P(x) && RBASIC(x)->klass == rb_cSymbol) -VALUE rb_id2sym(ID); -ID rb_sym2id(VALUE); -#define ID2SYM(x) rb_id2sym(x) -#define SYM2ID(x) rb_sym2id(x) +#define SYMBOL_FLAG 0x0e +#define SYMBOL_P(x) (((VALUE)(x)&0xff)==SYMBOL_FLAG) +#define ID2SYM(x) ((VALUE)(((long)(x))<<8|SYMBOL_FLAG)) +#define SYM2ID(x) RSHIFT((unsigned long)x,8) /* special contants - i.e. non-zero and non-fixnum constants */ #define Qfalse ((VALUE)0) -- cgit v1.2.3