aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-08-28 22:12:16 +0300
committerArnold D. Robbins <arnold@skeeve.com>2017-08-28 22:12:16 +0300
commite3d10b231e20e64c673556d3ed4eb96dbe8bbff3 (patch)
tree78efa4ed54bba9c56e8d0112f5eeb7903a9bb6da /builtin.c
parentebb3d8ff179f99fd2abf088743b1076fb8eaa20b (diff)
parent00af70530b9a79dbeee4d0e7a0fafdb9bee134d5 (diff)
downloadegawk-e3d10b231e20e64c673556d3ed4eb96dbe8bbff3.tar.gz
egawk-e3d10b231e20e64c673556d3ed4eb96dbe8bbff3.tar.bz2
egawk-e3d10b231e20e64c673556d3ed4eb96dbe8bbff3.zip
Merge branch 'master' into feature/fix-comments
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/builtin.c b/builtin.c
index bf838a8a..cd270e84 100644
--- a/builtin.c
+++ b/builtin.c
@@ -42,10 +42,13 @@
/* The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
-/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
- It is necessary at least when t == time_t. */
+/* Note: these assume that negative integers are represented internally
+ via 2's complement, which is not mandated by C. They also ignore the
+ fact that signed integer arithmetic overflow can trigger exceptions,
+ unlike unsigned which is guaranteed not to do so. */
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
- ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
+ ? ~ (uintmax_t) 0 << (sizeof (t) * CHAR_BIT - 1) \
+ : 0))
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
#ifndef INTMAX_MIN