summaryrefslogtreecommitdiff
path: root/node.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-29 02:58:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-29 02:58:53 +0000
commitc6c55bb78429d9305e8e1c65803ff3a388582ed6 (patch)
tree76e2953e54ba10bcda55adc6a8349c5ff64175aa /node.h
parenteb486f24e1765927438b2c04c5ae5ad841bcdd48 (diff)
node.h: sign-extend
* node.h (nd_line): should sign-extend. shifting `VALUE` extends with zero bits if `sizeof(VALUE)` equals to `sizeof(int)`. the zero bits are truncated if `sizeof(VALUE)` is bigger enough. [ruby-core:80920] [Bug #13523] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'node.h')
-rw-r--r--node.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/node.h b/node.h
index 8d2ea53c73..8fbe226a87 100644
--- a/node.h
+++ b/node.h
@@ -277,7 +277,7 @@ typedef struct RNode {
#define NODE_LSHIFT (NODE_TYPESHIFT+7)
#define NODE_LMASK (((SIGNED_VALUE)1<<(sizeof(VALUE)*CHAR_BIT-NODE_LSHIFT))-1)
-#define nd_line(n) (int)(RNODE(n)->flags>>NODE_LSHIFT)
+#define nd_line(n) (int)(((SIGNED_VALUE)RNODE(n)->flags)>>NODE_LSHIFT)
#define nd_set_line(n,l) \
RNODE(n)->flags=((RNODE(n)->flags&~((VALUE)(-1)<<NODE_LSHIFT))|((VALUE)((l)&NODE_LMASK)<<NODE_LSHIFT))