From: nobu.nokada@... Date: 2004-10-27T13:05:15+09:00 Subject: Re: Errors in line numbers reported? Hi, At Wed, 27 Oct 2004 09:33:54 +0900, Yukihiro Matsumoto wrote in [ruby-talk:117841]: > Interesting solution. I'm thinking of another fix; the following > flags have no use for nodes: > > FL_TAINT > FL_EXTIVAR > FL_FREEZE > > and possibly FL_FINALIZE. So we can use 3 (or 4) more bits to > represent line numbers, thus allowing 65535 (or 131071) lines maximum. Is it enough? Index: node.h =================================================================== RCS file: /cvs/ruby/src/ruby/node.h,v retrieving revision 1.57 diff -u -2 -p -r1.57 node.h --- node.h 2 Oct 2004 11:34:13 -0000 1.57 +++ node.h 27 Oct 2004 03:42:09 -0000 @@ -164,8 +164,26 @@ typedef struct RNode { #define NODE_LSHIFT (FL_USHIFT+8) -#define NODE_LMASK (((long)1<<(sizeof(NODE*)*CHAR_BIT-NODE_LSHIFT))-1) -#define nd_line(n) ((unsigned int)(((RNODE(n))->flags>>NODE_LSHIFT)&NODE_LMASK)) +#define NODE_LBITS (sizeof(NODE*)*CHAR_BIT-NODE_LSHIFT) +#define NODE_LMASK (~(~0L< 4 +#define NODE_LUSHIFT 0 +#define NODE_LUBITS 0 +#else +#define NODE_LUSHIFT 7 /* FL_FINALIZE */ +#define NODE_LUBITS 4 /* thru FL_FREEZE */ +#endif +#define NODE_LUMASK (~(~0L<flags&NODE_LUMASK)<<(NODE_LBITS-NODE_LUSHIFT)) +#define nd_line_upper(l) (((l)>>(NODE_LBITS-NODE_LUSHIFT))&NODE_LUMASK) +#else +#define nd_line_high(n) 0 +#define nd_line_upper(l) 0 +#endif +#define nd_line_low(n) ((unsigned int)(((RNODE(n))->flags>>NODE_LSHIFT)&NODE_LMASK)) +#define nd_line(n) (nd_line_low(n) | nd_line_high(n)) #define nd_set_line(n,l) \ - RNODE(n)->flags=((RNODE(n)->flags&~(-1<flags=((RNODE(n)->flags&~((NODE_LMASK<