guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 71/86: Use stdint.h limit macros


From: Andy Wingo
Subject: [Guile-commits] 71/86: Use stdint.h limit macros
Date: Wed, 20 Jun 2018 14:09:43 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit 2eb8fa1751dcb1b57bc607c6df61f9d363dff8c3
Author: Andy Wingo <address@hidden>
Date:   Wed Jun 20 14:55:49 2018 +0200

    Use stdint.h limit macros
    
    * libguile/__scm.h: Include <stdint.h>, now that we rely on C99.
      (SCM_T_UINT8_MAX, SCM_T_INT8_MIN, SCM_T_INT8_MAX, SCM_T_UINT16_MAX)
      (SCM_T_INT16_MIN, SCM_T_INT16_MAX, SCM_T_UINT32_MAX, SCM_T_INT32_MIN)
      (SCM_T_INT32_MAX, SCM_T_UINT64_MAX, SCM_T_INT64_MIN, SCM_T_INT64_MAX)
      (SCM_T_UINTMAX_MAX, SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX)
      (SCM_T_UINTPTR_MAX, SCM_T_INTPTR_MIN, SCM_T_INTPTR_MAX): Define in
      terms of equivalent stdint.h definitions.
    * libguile/gen-scmconfig.c:
    * libguile/instructions.c:
    * libguile/numbers.c:
    * libguile/random.c:
    * libguile/tags.h:
    * test-suite/standalone/test-conversion.c: Adapt to use C99 names.
---
 libguile/__scm.h                        |  38 +++----
 libguile/gen-scmconfig.c                |   4 +-
 libguile/instructions.c                 |   2 +-
 libguile/numbers.c                      |  24 ++---
 libguile/random.c                       |   2 +-
 libguile/tags.h                         |   6 +-
 test-suite/standalone/test-conversion.c | 177 ++++++++++++++++----------------
 7 files changed, 128 insertions(+), 125 deletions(-)

diff --git a/libguile/__scm.h b/libguile/__scm.h
index eae1afb..bd81cb0 100644
--- a/libguile/__scm.h
+++ b/libguile/__scm.h
@@ -37,6 +37,8 @@
  The main documentation is in gen-scmconfig.c.
  **********************************************************************/
 
+#include <stdint.h>
+
 /* What did the configure script discover about the outside world?  */
 #include "libguile/scmconfig.h"
 
@@ -289,29 +291,29 @@
 #define SCM_I_TYPE_MAX(type,umax)  ((type)((umax)/2))
 #define SCM_I_TYPE_MIN(type,umax)  (-((type)((umax)/2))-1)
 
-#define SCM_T_UINT8_MAX   SCM_I_UTYPE_MAX(scm_t_uint8)
-#define SCM_T_INT8_MIN    SCM_I_TYPE_MIN(scm_t_int8,SCM_T_UINT8_MAX)
-#define SCM_T_INT8_MAX    SCM_I_TYPE_MAX(scm_t_int8,SCM_T_UINT8_MAX)
+#define SCM_T_UINT8_MAX   UINT8_MAX
+#define SCM_T_INT8_MIN    INT8_MIN
+#define SCM_T_INT8_MAX    INT8_MAX
 
-#define SCM_T_UINT16_MAX  SCM_I_UTYPE_MAX(scm_t_uint16)
-#define SCM_T_INT16_MIN   SCM_I_TYPE_MIN(scm_t_int16,SCM_T_UINT16_MAX)
-#define SCM_T_INT16_MAX   SCM_I_TYPE_MAX(scm_t_int16,SCM_T_UINT16_MAX)
+#define SCM_T_UINT16_MAX  UINT16_MAX
+#define SCM_T_INT16_MIN   INT16_MIN
+#define SCM_T_INT16_MAX   INT16_MAX
 
-#define SCM_T_UINT32_MAX  SCM_I_UTYPE_MAX(scm_t_uint32)
-#define SCM_T_INT32_MIN   SCM_I_TYPE_MIN(scm_t_int32,SCM_T_UINT32_MAX)
-#define SCM_T_INT32_MAX   SCM_I_TYPE_MAX(scm_t_int32,SCM_T_UINT32_MAX)
+#define SCM_T_UINT32_MAX  UINT32_MAX
+#define SCM_T_INT32_MIN   INT32_MIN
+#define SCM_T_INT32_MAX   INT32_MAX
 
-#define SCM_T_UINT64_MAX  SCM_I_UTYPE_MAX(scm_t_uint64)
-#define SCM_T_INT64_MIN   SCM_I_TYPE_MIN(scm_t_int64,SCM_T_UINT64_MAX)
-#define SCM_T_INT64_MAX   SCM_I_TYPE_MAX(scm_t_int64,SCM_T_UINT64_MAX)
+#define SCM_T_UINT64_MAX  UINT64_MAX
+#define SCM_T_INT64_MIN   INT64_MIN
+#define SCM_T_INT64_MAX   INT64_MAX
 
-#define SCM_T_UINTMAX_MAX SCM_I_UTYPE_MAX(scm_t_uintmax)
-#define SCM_T_INTMAX_MIN  SCM_I_TYPE_MIN(scm_t_intmax,SCM_T_UINTMAX_MAX)
-#define SCM_T_INTMAX_MAX  SCM_I_TYPE_MAX(scm_t_intmax,SCM_T_UINTMAX_MAX)
+#define SCM_T_UINTMAX_MAX UINTMAX_MAX
+#define SCM_T_INTMAX_MIN  INTMAX_MIN
+#define SCM_T_INTMAX_MAX  INTMAX_MAX
 
-#define SCM_T_UINTPTR_MAX SCM_I_UTYPE_MAX(scm_t_uintptr)
-#define SCM_T_INTPTR_MIN  SCM_I_TYPE_MIN(scm_t_intptr,SCM_T_UINTPTR_MAX)
-#define SCM_T_INTPTR_MAX  SCM_I_TYPE_MAX(scm_t_intptr,SCM_T_UINTPTR_MAX)
+#define SCM_T_UINTPTR_MAX UINTPTR_MAX
+#define SCM_T_INTPTR_MIN  INTPTR_MIN
+#define SCM_T_INTPTR_MAX  INTPTR_MAX
 
 
 
diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c
index 1d4d31a..4ac90f0 100644
--- a/libguile/gen-scmconfig.c
+++ b/libguile/gen-scmconfig.c
@@ -375,8 +375,8 @@ main (int argc, char *argv[])
 
 #if defined GUILE_USE_64_CALLS && defined HAVE_STAT64
   pf ("typedef scm_t_int64 scm_t_off;\n");
-  pf ("#define SCM_T_OFF_MAX SCM_T_INT64_MAX\n");
-  pf ("#define SCM_T_OFF_MIN SCM_T_INT64_MIN\n");
+  pf ("#define SCM_T_OFF_MAX INT64_MAX\n");
+  pf ("#define SCM_T_OFF_MIN INT64_MIN\n");
 #elif SIZEOF_OFF_T == SIZEOF_INT
   pf ("typedef int scm_t_off;\n");
   pf ("#define SCM_T_OFF_MAX INT_MAX\n");
diff --git a/libguile/instructions.c b/libguile/instructions.c
index 65dca5b..91af5f6 100644
--- a/libguile/instructions.c
+++ b/libguile/instructions.c
@@ -103,7 +103,7 @@ static SCM word_type_symbols[] =
    by Scheme to generate assemblers and disassemblers for the
    instructions.  */
 
-#define NOP SCM_T_UINT64_MAX
+#define NOP UINT64_MAX
 #define OP1(type0) \
   (OP (0, type0))
 #define OP2(type0, type1) \
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 659f87a..566fb76 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -9742,8 +9742,8 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
 #include "libguile/conv-uinteger.i.c"
 
 #define TYPE                     scm_t_int8
-#define TYPE_MIN                 SCM_T_INT8_MIN
-#define TYPE_MAX                 SCM_T_INT8_MAX
+#define TYPE_MIN                 INT8_MIN
+#define TYPE_MAX                 INT8_MAX
 #define SIZEOF_TYPE              1
 #define SCM_TO_TYPE_PROTO(arg)   scm_to_int8 (arg)
 #define SCM_FROM_TYPE_PROTO(arg) scm_from_int8 (arg)
@@ -9751,15 +9751,15 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
 
 #define TYPE                     scm_t_uint8
 #define TYPE_MIN                 0
-#define TYPE_MAX                 SCM_T_UINT8_MAX
+#define TYPE_MAX                 UINT8_MAX
 #define SIZEOF_TYPE              1
 #define SCM_TO_TYPE_PROTO(arg)   scm_to_uint8 (arg)
 #define SCM_FROM_TYPE_PROTO(arg) scm_from_uint8 (arg)
 #include "libguile/conv-uinteger.i.c"
 
 #define TYPE                     scm_t_int16
-#define TYPE_MIN                 SCM_T_INT16_MIN
-#define TYPE_MAX                 SCM_T_INT16_MAX
+#define TYPE_MIN                 INT16_MIN
+#define TYPE_MAX                 INT16_MAX
 #define SIZEOF_TYPE              2
 #define SCM_TO_TYPE_PROTO(arg)   scm_to_int16 (arg)
 #define SCM_FROM_TYPE_PROTO(arg) scm_from_int16 (arg)
@@ -9767,15 +9767,15 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
 
 #define TYPE                     scm_t_uint16
 #define TYPE_MIN                 0
-#define TYPE_MAX                 SCM_T_UINT16_MAX
+#define TYPE_MAX                 UINT16_MAX
 #define SIZEOF_TYPE              2
 #define SCM_TO_TYPE_PROTO(arg)   scm_to_uint16 (arg)
 #define SCM_FROM_TYPE_PROTO(arg) scm_from_uint16 (arg)
 #include "libguile/conv-uinteger.i.c"
 
 #define TYPE                     scm_t_int32
-#define TYPE_MIN                 SCM_T_INT32_MIN
-#define TYPE_MAX                 SCM_T_INT32_MAX
+#define TYPE_MIN                 INT32_MIN
+#define TYPE_MAX                 INT32_MAX
 #define SIZEOF_TYPE              4
 #define SCM_TO_TYPE_PROTO(arg)   scm_to_int32 (arg)
 #define SCM_FROM_TYPE_PROTO(arg) scm_from_int32 (arg)
@@ -9783,7 +9783,7 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
 
 #define TYPE                     scm_t_uint32
 #define TYPE_MIN                 0
-#define TYPE_MAX                 SCM_T_UINT32_MAX
+#define TYPE_MAX                 UINT32_MAX
 #define SIZEOF_TYPE              4
 #define SCM_TO_TYPE_PROTO(arg)   scm_to_uint32 (arg)
 #define SCM_FROM_TYPE_PROTO(arg) scm_from_uint32 (arg)
@@ -9798,8 +9798,8 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
 #include "libguile/conv-integer.i.c"
 
 #define TYPE                     scm_t_int64
-#define TYPE_MIN                 SCM_T_INT64_MIN
-#define TYPE_MAX                 SCM_T_INT64_MAX
+#define TYPE_MIN                 INT64_MIN
+#define TYPE_MAX                 INT64_MAX
 #define SIZEOF_TYPE              8
 #define SCM_TO_TYPE_PROTO(arg)   scm_to_int64 (arg)
 #define SCM_FROM_TYPE_PROTO(arg) scm_from_int64 (arg)
@@ -9807,7 +9807,7 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
 
 #define TYPE                     scm_t_uint64
 #define TYPE_MIN                 0
-#define TYPE_MAX                 SCM_T_UINT64_MAX
+#define TYPE_MAX                 UINT64_MAX
 #define SIZEOF_TYPE              8
 #define SCM_TO_TYPE_PROTO(arg)   scm_to_uint64 (arg)
 #define SCM_FROM_TYPE_PROTO(arg) scm_from_uint64 (arg)
diff --git a/libguile/random.c b/libguile/random.c
index 10cd76a..d7901d6 100644
--- a/libguile/random.c
+++ b/libguile/random.c
@@ -278,7 +278,7 @@ scm_c_random64 (scm_t_rstate *state, scm_t_uint64 m)
   scm_t_uint64 r;
   scm_t_uint32 mask;
 
-  if (m <= SCM_T_UINT32_MAX)
+  if (m <= UINT32_MAX)
     return scm_c_random (state, (scm_t_uint32) m);
   
   mask = scm_i_mask32 (m >> 32);
diff --git a/libguile/tags.h b/libguile/tags.h
index 6435e3b..b1406e1 100644
--- a/libguile/tags.h
+++ b/libguile/tags.h
@@ -63,9 +63,9 @@
 typedef scm_t_intptr  scm_t_signed_bits;
 typedef scm_t_uintptr scm_t_bits;
 
-#define SCM_T_SIGNED_BITS_MAX SCM_T_INTPTR_MAX
-#define SCM_T_SIGNED_BITS_MIN SCM_T_INTPTR_MIN
-#define SCM_T_BITS_MAX        SCM_T_UINTPTR_MAX
+#define SCM_T_SIGNED_BITS_MAX INTPTR_MAX
+#define SCM_T_SIGNED_BITS_MIN INTPTR_MIN
+#define SCM_T_BITS_MAX        UINTPTR_MAX
 
 
 /* But as external interface, we define SCM, which may, according to the
diff --git a/test-suite/standalone/test-conversion.c 
b/test-suite/standalone/test-conversion.c
index 700e5b3..72e34af 100644
--- a/test-suite/standalone/test-conversion.c
+++ b/test-suite/standalone/test-conversion.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999,2000,2001,2003,2004, 2006, 2007, 2008, 2009, 2010 Free 
Software Foundation, Inc.
+/* Copyright (C) 1999-2001,2003-2004,2006-2010,2018
+ *   Free Software Foundation, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -59,57 +60,57 @@ static void
 test_is_signed_integer ()
 {
   test_1 ("'foo", 
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          0);
   test_1 ("3.0", 
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          0);
   test_1 ("(inexact->exact 3.0)", 
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          1);
   test_1 ("3.5",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          0);
   test_1 ("most-positive-fixnum",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          1);
   test_1 ("(+ most-positive-fixnum 1)",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          1);
   test_1 ("most-negative-fixnum",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          1);
   test_1 ("(- most-negative-fixnum 1)",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          1);
   if (sizeof (scm_t_intmax) == 8)
     {
       test_1 ("(- (expt 2 63) 1)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              1);
       test_1 ("(expt 2 63)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              0);
       test_1 ("(- (expt 2 63))",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              1);
       test_1 ("(- (- (expt 2 63)) 1)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              0);
     }
   else if (sizeof (scm_t_intmax) == 4)
     {
       test_1 ("(- (expt 2 31) 1)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              1);
       test_1 ("(expt 2 31)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              0);
       test_1 ("(- (expt 2 31))",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              1);
       test_1 ("(- (- (expt 2 31)) 1)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              0);
     }
   else
@@ -145,45 +146,45 @@ static void
 test_is_unsigned_integer ()
 {
   test_2 ("'foo", 
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          0);
   test_2 ("3.0", 
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          0);
   test_2 ("(inexact->exact 3.0)", 
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          1);
   test_2 ("3.5",
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          0);
   test_2 ("most-positive-fixnum",
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          1);
   test_2 ("(+ most-positive-fixnum 1)",
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          1);
   test_2 ("most-negative-fixnum",
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          0);
   test_2 ("(- most-negative-fixnum 1)",
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          0);
   if (sizeof (scm_t_intmax) == 8)
     {
       test_2 ("(- (expt 2 64) 1)",
-             0, SCM_T_UINTMAX_MAX,
+             0, UINTMAX_MAX,
              1);
       test_2 ("(expt 2 64)",
-             0, SCM_T_UINTMAX_MAX,
+             0, UINTMAX_MAX,
              0);
     }
   else if (sizeof (scm_t_intmax) == 4)
     {
       test_2 ("(- (expt 2 32) 1)",
-             0, SCM_T_UINTMAX_MAX,
+             0, UINTMAX_MAX,
              1);
       test_2 ("(expt 2 32)",
-             0, SCM_T_UINTMAX_MAX,
+             0, UINTMAX_MAX,
              0);
     }
   else
@@ -294,13 +295,13 @@ static void
 test_to_signed_integer ()
 {
   test_3 ("'foo",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          0, 0, 1);
   test_3 ("3.5",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          0, 0, 1);
   test_3 ("12",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          12, 0, 0);
   test_3 ("1000",
          -999, 999,
@@ -309,51 +310,51 @@ test_to_signed_integer ()
          -999, 999,
          0, 1, 0);
   test_3 ("most-positive-fixnum",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          SCM_MOST_POSITIVE_FIXNUM, 0, 0);
   test_3 ("most-negative-fixnum",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          SCM_MOST_NEGATIVE_FIXNUM, 0, 0);
   test_3 ("(+ most-positive-fixnum 1)",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          SCM_MOST_POSITIVE_FIXNUM+1, 0, 0);
   test_3 ("(- most-negative-fixnum 1)",
-         SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+         INTMAX_MIN, INTMAX_MAX,
          SCM_MOST_NEGATIVE_FIXNUM-1, 0, 0);
   if (sizeof (scm_t_intmax) == 8)
     {
       test_3 ("(- (expt 2 63) 1)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
-             SCM_T_INTMAX_MAX, 0, 0);
+             INTMAX_MIN, INTMAX_MAX,
+             INTMAX_MAX, 0, 0);
       test_3 ("(+ (- (expt 2 63)) 1)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
-             SCM_T_INTMAX_MIN+1, 0, 0);
+             INTMAX_MIN, INTMAX_MAX,
+             INTMAX_MIN+1, 0, 0);
       test_3 ("(- (expt 2 63))",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
-             SCM_T_INTMAX_MIN, 0, 0);
+             INTMAX_MIN, INTMAX_MAX,
+             INTMAX_MIN, 0, 0);
       test_3 ("(expt 2 63)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              0, 1, 0);
       test_3 ("(- (- (expt 2 63)) 1)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              0, 1, 0);
     }
   else if (sizeof (scm_t_intmax) == 4)
     {
       test_3 ("(- (expt 2 31) 1)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
-             SCM_T_INTMAX_MAX, 0, 0);
+             INTMAX_MIN, INTMAX_MAX,
+             INTMAX_MAX, 0, 0);
       test_3 ("(+ (- (expt 2 31)) 1)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
-             SCM_T_INTMAX_MIN+1, 0, 0);
+             INTMAX_MIN, INTMAX_MAX,
+             INTMAX_MIN+1, 0, 0);
       test_3 ("(- (expt 2 31))",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
-             SCM_T_INTMAX_MIN, 0, 0);
+             INTMAX_MIN, INTMAX_MAX,
+             INTMAX_MIN, 0, 0);
       test_3 ("(expt 2 31)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              0, 1, 0);
       test_3 ("(- (- (expt 2 31)) 1)",
-             SCM_T_INTMAX_MIN, SCM_T_INTMAX_MAX,
+             INTMAX_MIN, INTMAX_MAX,
              0, 1, 0);
     }
   else
@@ -429,39 +430,39 @@ static void
 test_to_unsigned_integer ()
 {
   test_4 ("'foo",
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          0, 0, 1);
   test_4 ("3.5",
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          0, 0, 1);
   test_4 ("12",
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          12, 0, 0);
   test_4 ("1000",
          0, 999,
          0, 1, 0);
   test_4 ("most-positive-fixnum",
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          SCM_MOST_POSITIVE_FIXNUM, 0, 0);
   test_4 ("(+ most-positive-fixnum 1)",
-         0, SCM_T_UINTMAX_MAX,
+         0, UINTMAX_MAX,
          SCM_MOST_POSITIVE_FIXNUM+1, 0, 0);
   if (sizeof (scm_t_intmax) == 8)
     {
       test_4 ("(- (expt 2 64) 1)",
-             0, SCM_T_UINTMAX_MAX,
-             SCM_T_UINTMAX_MAX, 0, 0);
+             0, UINTMAX_MAX,
+             UINTMAX_MAX, 0, 0);
       test_4 ("(expt 2 64)",
-             0, SCM_T_UINTMAX_MAX,
+             0, UINTMAX_MAX,
              0, 1, 0);
     }
   else if (sizeof (scm_t_intmax) == 4)
     {
       test_4 ("(- (expt 2 32) 1)",
-             0, SCM_T_UINTMAX_MAX,
-             SCM_T_UINTMAX_MAX, 0, 0);
+             0, UINTMAX_MAX,
+             UINTMAX_MAX, 0, 0);
       test_4 ("(expt 2 32)",
-             0, SCM_T_UINTMAX_MAX,
+             0, UINTMAX_MAX,
              0, 1, 0);
     }
   else
@@ -486,13 +487,13 @@ test_from_signed_integer ()
   test_5 (12, "12");
   if (sizeof (scm_t_intmax) == 8)
     {
-      test_5 (SCM_T_INTMAX_MAX, "(- (expt 2 63) 1)");
-      test_5 (SCM_T_INTMAX_MIN, "(- (expt 2 63))");
+      test_5 (INTMAX_MAX, "(- (expt 2 63) 1)");
+      test_5 (INTMAX_MIN, "(- (expt 2 63))");
     }
   else if (sizeof (scm_t_intmax) == 4)
     {
-      test_5 (SCM_T_INTMAX_MAX, "(- (expt 2 31) 1)");
-      test_5 (SCM_T_INTMAX_MIN, "(- (expt 2 31))");
+      test_5 (INTMAX_MAX, "(- (expt 2 31) 1)");
+      test_5 (INTMAX_MIN, "(- (expt 2 31))");
     }
   test_5 (SCM_MOST_POSITIVE_FIXNUM, "most-positive-fixnum");
   test_5 (SCM_MOST_NEGATIVE_FIXNUM, "most-negative-fixnum");
@@ -519,11 +520,11 @@ test_from_unsigned_integer ()
   test_6 (12, "12");
   if (sizeof (scm_t_intmax) == 8)
     {
-      test_6 (SCM_T_UINTMAX_MAX, "(- (expt 2 64) 1)");
+      test_6 (UINTMAX_MAX, "(- (expt 2 64) 1)");
     }
   else if (sizeof (scm_t_intmax) == 4)
     {
-      test_6 (SCM_T_UINTMAX_MAX, "(- (expt 2 32) 1)");
+      test_6 (UINTMAX_MAX, "(- (expt 2 32) 1)");
     }
   test_6 (SCM_MOST_POSITIVE_FIXNUM, "most-positive-fixnum");
   test_6 (SCM_MOST_POSITIVE_FIXNUM+1, "(+ most-positive-fixnum 1)");
@@ -739,14 +740,14 @@ test_int_sizes ()
   TEST_7S (scm_from_int16,  32768, "-32768");
   TEST_7U (scm_from_uint16, 65535,  "65535");
 
-  TEST_7S (scm_from_int32,  SCM_T_INT32_MIN,     "-2147483648");
-  TEST_7S (scm_from_int32,  SCM_T_INT32_MAX,      "2147483647");
-  TEST_7S (scm_from_int32,  SCM_T_INT32_MAX+1LL, "-2147483648");
-  TEST_7U (scm_from_uint32, SCM_T_UINT32_MAX,     "4294967295");
+  TEST_7S (scm_from_int32,  INT32_MIN,     "-2147483648");
+  TEST_7S (scm_from_int32,  INT32_MAX,      "2147483647");
+  TEST_7S (scm_from_int32,  INT32_MAX+1LL, "-2147483648");
+  TEST_7U (scm_from_uint32, UINT32_MAX,     "4294967295");
 
-  TEST_7S (scm_from_int64,  SCM_T_INT64_MIN,  "-9223372036854775808");
-  TEST_7S (scm_from_int64,  SCM_T_INT64_MAX,   "9223372036854775807");
-  TEST_7U (scm_from_uint64, SCM_T_UINT64_MAX, "18446744073709551615");
+  TEST_7S (scm_from_int64,  INT64_MIN,  "-9223372036854775808");
+  TEST_7S (scm_from_int64,  INT64_MAX,   "9223372036854775807");
+  TEST_7U (scm_from_uint64, UINT64_MAX, "18446744073709551615");
 
   TEST_8S ("91",   scm_to_schar,   91, 0, 0);
   TEST_8U ("91",   scm_to_uchar,   91, 0, 0);
@@ -764,38 +765,38 @@ test_int_sizes ()
   TEST_8U ("911",  scm_to_size_t,   911, 0, 0);
   TEST_8S ("911",  scm_to_ssize_t,  911, 0, 0);
 
-  TEST_8S ("-128", scm_to_int8,   SCM_T_INT8_MIN, 0, 0);
-  TEST_8S ("127",  scm_to_int8,   SCM_T_INT8_MAX, 0, 0);
+  TEST_8S ("-128", scm_to_int8,   INT8_MIN, 0, 0);
+  TEST_8S ("127",  scm_to_int8,   INT8_MAX, 0, 0);
   TEST_8S ("128",  scm_to_int8,                0, 1, 0);
   TEST_8S ("#f",   scm_to_int8,                0, 0, 1);
-  TEST_8U ("255",  scm_to_uint8, SCM_T_UINT8_MAX, 0, 0);
+  TEST_8U ("255",  scm_to_uint8, UINT8_MAX, 0, 0);
   TEST_8U ("256",  scm_to_uint8,               0, 1, 0);
   TEST_8U ("-1",   scm_to_uint8,               0, 1, 0);
   TEST_8U ("#f",   scm_to_uint8,               0, 0, 1);
 
-  TEST_8S ("-32768", scm_to_int16,   SCM_T_INT16_MIN, 0, 0);
-  TEST_8S ("32767",  scm_to_int16,   SCM_T_INT16_MAX, 0, 0);
+  TEST_8S ("-32768", scm_to_int16,   INT16_MIN, 0, 0);
+  TEST_8S ("32767",  scm_to_int16,   INT16_MAX, 0, 0);
   TEST_8S ("32768",  scm_to_int16,                 0, 1, 0);
   TEST_8S ("#f",     scm_to_int16,                 0, 0, 1);
-  TEST_8U ("65535",  scm_to_uint16, SCM_T_UINT16_MAX, 0, 0);
+  TEST_8U ("65535",  scm_to_uint16, UINT16_MAX, 0, 0);
   TEST_8U ("65536",  scm_to_uint16,                0, 1, 0);
   TEST_8U ("-1",     scm_to_uint16,                0, 1, 0);
   TEST_8U ("#f",     scm_to_uint16,                0, 0, 1);
 
-  TEST_8S ("-2147483648", scm_to_int32,   SCM_T_INT32_MIN, 0, 0);
-  TEST_8S ("2147483647",  scm_to_int32,   SCM_T_INT32_MAX, 0, 0);
+  TEST_8S ("-2147483648", scm_to_int32,   INT32_MIN, 0, 0);
+  TEST_8S ("2147483647",  scm_to_int32,   INT32_MAX, 0, 0);
   TEST_8S ("2147483648",  scm_to_int32,                 0, 1, 0);
   TEST_8S ("#f",          scm_to_int32,                 0, 0, 1);
-  TEST_8U ("4294967295",  scm_to_uint32, SCM_T_UINT32_MAX, 0, 0);
+  TEST_8U ("4294967295",  scm_to_uint32, UINT32_MAX, 0, 0);
   TEST_8U ("4294967296",  scm_to_uint32,                0, 1, 0);
   TEST_8U ("-1",          scm_to_uint32,                0, 1, 0);
   TEST_8U ("#f",          scm_to_uint32,                0, 0, 1);
 
-  TEST_8S ("-9223372036854775808", scm_to_int64,   SCM_T_INT64_MIN, 0, 0);
-  TEST_8S ("9223372036854775807",  scm_to_int64,   SCM_T_INT64_MAX, 0, 0);
+  TEST_8S ("-9223372036854775808", scm_to_int64,   INT64_MIN, 0, 0);
+  TEST_8S ("9223372036854775807",  scm_to_int64,   INT64_MAX, 0, 0);
   TEST_8S ("9223372036854775808",  scm_to_int64,                 0, 1, 0);
   TEST_8S ("#f",                   scm_to_int64,                 0, 0, 1);
-  TEST_8U ("18446744073709551615", scm_to_uint64, SCM_T_UINT64_MAX, 0, 0);
+  TEST_8U ("18446744073709551615", scm_to_uint64, UINT64_MAX, 0, 0);
   TEST_8U ("18446744073709551616", scm_to_uint64,                0, 1, 0);
   TEST_8U ("-1",                   scm_to_uint64,                0, 1, 0);
   TEST_8U ("#f",                   scm_to_uint64,                0, 0, 1);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]