ack/lang/cem/cpp.ansi
George Koehler 59b3c10563 Use (arith) 1 << ... when getting the sign bit.
This prevents an overflow reported by @hexcoder- in
https://github.com/davidgiven/ack/issues/56

lang/cem/cpp.ansi/LLlex.c used a plain 1 << ... and caused an overflow
on machines where sizeof(int) < sizeof(long).  Using 1L << ... would
work for now but might fail later if arith became long long.

C doesn't specify whether negative integers use 2's complement or some
other format.  Therefore, (arith) 1 << ... has an undefined value.  It
should still work because the value is some integer where the sign bit
is set and all other bits are clear.

(unsigned arith) 1 << ... would also get the sign bit, but casting it
from unsigned back to signed would make the same undefined value.

(arith) -1 << ... would assume 2's complement.
2017-10-29 17:45:10 -04:00
..
arith.h Use (arith) 1 << ... when getting the sign bit. 2017-10-29 17:45:10 -04:00
bits.h First milestone of replacing the build system. 2013-05-12 20:45:55 +01:00
build.lua Biggish refactor to break cycles; my build rules were full of them. cpm builds, 2016-08-14 01:39:40 +02:00
ch3bin.c Use (arith) 1 << ... when getting the sign bit. 2017-10-29 17:45:10 -04:00
ch3mon.c fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
char.tab Initial revision 1989-10-23 10:35:56 +00:00
class.h fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
domacro.c Add enough return types to the K&R C that the ACK builds (on Linux) using clang 2016-11-10 22:04:18 +01:00
error.c First milestone of replacing the build system. 2013-05-12 20:45:55 +01:00
expr.c fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
expression.g fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
file_info.h fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
idf.c fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
idf.h fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
init.c Remove sys_time in favour of directly calling time(). 2016-11-09 21:52:04 +01:00
input.c Replaced calls to the custom strindex() and strrindex() functions with the 2006-07-23 20:01:02 +00:00
input.h First milestone of replacing the build system. 2013-05-12 20:45:55 +01:00
LLlex.c Use (arith) 1 << ... when getting the sign bit. 2017-10-29 17:45:10 -04:00
LLlex.h fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
LLmessage.c fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
macro.str fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
main.c Add enough return types to the K&R C that the ACK builds (on Linux) using clang 2016-11-10 22:04:18 +01:00
make.allocd Added the appropriate #! magic at the beginning of shell scripts. (Some modern shells don't like scripts to be without it.) 2006-07-18 16:45:57 +00:00
make.next fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
make.tokcase fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
make.tokfile fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
ncpp.6 fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
options.c First milestone of replacing the build system. 2013-05-12 20:45:55 +01:00
parameters.h First milestone of replacing the build system. 2013-05-12 20:45:55 +01:00
preprocess.c Add enough return types to the K&R C that the ACK builds (on Linux) using clang 2016-11-10 22:04:18 +01:00
proto.main fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
proto.make fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
replace.c Fix a whole lot more stray prototypes. 2016-11-24 21:47:40 +01:00
replace.str fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
skip.c fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00
tokenname.c fixup commit for tag 'llgen-1-0' 2006-02-04 00:57:05 +00:00