aboutsummaryrefslogtreecommitdiffstats
path: root/libasn1compiler/asn1c_misc.c
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2005-08-15 01:01:24 +0000
committerLev Walkin <vlm@lionet.info>2005-08-15 01:01:24 +0000
commit4c97bd6100938fe69669e5c06f70b7d78eaafd83 (patch)
tree91c8258f82e03ce33b1b393bd5481a40402495c6 /libasn1compiler/asn1c_misc.c
parent0f5d74c6d35efd3de68b83ae703e5326686cfee9 (diff)
some platforms don't have INTxx_MIN
Diffstat (limited to 'libasn1compiler/asn1c_misc.c')
-rw-r--r--libasn1compiler/asn1c_misc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libasn1compiler/asn1c_misc.c b/libasn1compiler/asn1c_misc.c
index 35de213e..c8cd2e70 100644
--- a/libasn1compiler/asn1c_misc.c
+++ b/libasn1compiler/asn1c_misc.c
@@ -257,9 +257,12 @@ asn1c_type_fits_long(arg_t *arg, asn1p_expr_t *expr) {
* Since we don't know the sizeof(long) on the possible target platform
* which will be compiling the code generated by asn1c, let's play it
* simple: long's range is equal to or greater than int32_t.
+ * NOTE: the most negative integer cannot be written in C, as the C99
+ * standard will give it an unsigned type.
+ * It is defined here as a constant expression.
*/
-#define LEFTMIN INT32_MIN
-#define RIGHTMAX INT32_MAX
+#define LEFTMIN 2147483647
+#define RIGHTMAX (-LEFTMIN-1)
/* Descend to the terminal type */
expr = asn1f_find_terminal_type_ex(arg->asn, expr);