From 10cf7c5b2a079473db81af6dd3aad29dd779d8b1 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 23 Mar 2014 01:10:12 +0000 Subject: [PATCH] hash.c: use ID_SCOPE_SHIFT * hash.c (rb_any_hash): use ID_SCOPE_SHIFT instead of magic number. [Feature #9425] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- common.mk | 2 +- hash.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common.mk b/common.mk index 8c097e374b..b0ab4f81d7 100644 --- a/common.mk +++ b/common.mk @@ -684,7 +684,7 @@ gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \ {$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \ {$(VPATH)}internal.h {$(VPATH)}constant.h \ {$(VPATH)}thread.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}debug.h -hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \ +hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h {$(VPATH)}id.h \ $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h inits.$(OBJEXT): {$(VPATH)}inits.c $(RUBY_H_INCLUDES) \ {$(VPATH)}internal.h diff --git a/hash.c b/hash.c index 56917ed056..007508a3c5 100644 --- a/hash.c +++ b/hash.c @@ -18,6 +18,7 @@ #include "internal.h" #include #include "probes.h" +#include "id.h" #ifdef __APPLE__ # ifdef HAVE_CRT_EXTERNS_H @@ -132,7 +133,7 @@ rb_any_hash(VALUE a) if (SPECIAL_CONST_P(a)) { if (a == Qundef) return 0; - if (SYMBOL_P(a)) a >>= (RUBY_SPECIAL_SHIFT + 3); /* 3=ID_SCOPE_SHIFT */ + if (SYMBOL_P(a)) a >>= (RUBY_SPECIAL_SHIFT + ID_SCOPE_SHIFT); hnum = rb_objid_hash((st_index_t)a); } else if (BUILTIN_TYPE(a) == T_STRING) {