1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-29 00:10:21 +02:00

remove SCM_HAVE_T_INT64, SCM_HAVE_T_UINT64

* libguile/__scm.h:
* libguile/numbers.h:
* libguile/random.c:
* libguile/srfi-4.c:
* libguile/srfi-4.h:
* libguile/numbers.c:
* test-suite/standalone/test-conversion.c:
* libguile/gen-scmconfig.c: As we require 64-bit integers in
  configure.ac, remove conditional definition of 64-bit types.
This commit is contained in:
Andy Wingo 2010-07-22 20:56:55 +02:00
parent 77b139121d
commit 4ca4826997
8 changed files with 8 additions and 86 deletions

View file

@ -390,11 +390,9 @@
#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)
#if SCM_HAVE_T_INT64
#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)
#endif
#if SCM_SIZEOF_LONG_LONG
#define SCM_I_ULLONG_MAX SCM_I_UTYPE_MAX(unsigned long long)

View file

@ -78,9 +78,7 @@
type.
- we now use SCM_SIZEOF_FOO != 0 rather than SCM_HAVE_FOO for any
cases where the size might actually vary. For types where the
size is fixed, we use SCM_HAVE_FOO, i.e. you can see us define or
not define SCM_HAVE_T_INT64 below when appropriate.
cases where the size might actually vary.
Rationales (not finished):
@ -290,28 +288,10 @@ main (int argc, char *argv[])
return 1;
pf ("\n");
pf ("/* 64-bit integer -- if available SCM_HAVE_T_INT64 will be 1 and\n"
" scm_t_int64 will be a suitable type, otherwise SCM_HAVE_T_INT64\n"
" will be 0. */\n");
if (SCM_I_GSC_T_INT64)
{
pf ("#define SCM_HAVE_T_INT64 1 /* 0 or 1 */\n");
pf ("typedef %s scm_t_int64;\n", SCM_I_GSC_T_INT64);
}
else
pf ("#define SCM_HAVE_T_INT64 0 /* 0 or 1 */\n");
pf ("\n");
pf ("/* 64-bit unsigned integer -- if available SCM_HAVE_T_UINT64 will\n"
" be 1 and scm_t_uint64 will be a suitable type, otherwise\n"
" SCM_HAVE_T_UINT64 will be 0. */\n");
if (SCM_I_GSC_T_UINT64)
{
pf ("#define SCM_HAVE_T_UINT64 1 /* 0 or 1 */\n");
pf ("typedef %s scm_t_uint64;\n", SCM_I_GSC_T_UINT64);
}
else
pf ("#define SCM_HAVE_T_UINT64 0 /* 0 or 1 */\n");
pf ("#define SCM_HAVE_T_INT64 1 /* 0 or 1 */\n");
pf ("typedef %s scm_t_int64;\n", SCM_I_GSC_T_INT64);
pf ("#define SCM_HAVE_T_UINT64 1 /* 0 or 1 */\n");
pf ("typedef %s scm_t_uint64;\n", SCM_I_GSC_T_UINT64);
pf ("\n");
pf ("/* scm_t_ptrdiff_t and size, always defined -- defined to long if\n"

View file

@ -6285,8 +6285,6 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_wchar (arg)
#include "libguile/conv-integer.i.c"
#if SCM_HAVE_T_INT64
#define TYPE scm_t_int64
#define TYPE_MIN SCM_T_INT64_MIN
#define TYPE_MAX SCM_T_INT64_MAX
@ -6303,8 +6301,6 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_uint64 (arg)
#include "libguile/conv-uinteger.i.c"
#endif
void
scm_to_mpz (SCM val, mpz_t rop)
{

View file

@ -3,7 +3,7 @@
#ifndef SCM_NUMBERS_H
#define SCM_NUMBERS_H
/* Copyright (C) 1995,1996,1998,2000,2001,2002,2003,2004,2005, 2006, 2008, 2009 Free Software Foundation, Inc.
/* Copyright (C) 1995,1996,1998,2000,2001,2002,2003,2004,2005, 2006, 2008, 2009, 2010 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
@ -353,16 +353,12 @@ SCM_API SCM scm_from_uint32 (scm_t_uint32 x);
SCM_API scm_t_wchar scm_to_wchar (SCM x);
SCM_API SCM scm_from_wchar (scm_t_wchar x);
#if SCM_HAVE_T_INT64
SCM_API scm_t_int64 scm_to_int64 (SCM x);
SCM_API SCM scm_from_int64 (scm_t_int64 x);
SCM_API scm_t_uint64 scm_to_uint64 (SCM x);
SCM_API SCM scm_from_uint64 (scm_t_uint64 x);
#endif
SCM_API void scm_to_mpz (SCM x, mpz_t rop);
SCM_API SCM scm_from_mpz (mpz_t rop);

View file

@ -77,8 +77,6 @@ scm_t_rng scm_the_rng;
#define M_PI 3.14159265359
#endif
#if SCM_HAVE_T_UINT64
unsigned long
scm_i_uniform32 (scm_t_i_rstate *state)
{
@ -89,38 +87,6 @@ scm_i_uniform32 (scm_t_i_rstate *state)
return w;
}
#else
/* ww This is a portable version of the same RNG without 64 bit
* * aa arithmetic.
* ----
* xx It is only intended to provide identical behaviour on
* xx platforms without 8 byte longs or long longs until
* xx someone has implemented the routine in assembler code.
* xxcc
* ----
* ccww
*/
#define L(x) ((x) & 0xffff)
#define H(x) ((x) >> 16)
unsigned long
scm_i_uniform32 (scm_t_i_rstate *state)
{
scm_t_uint32 x1 = L (A) * L (state->w);
scm_t_uint32 x2 = L (A) * H (state->w);
scm_t_uint32 x3 = H (A) * L (state->w);
scm_t_uint32 w = L (x1) + L (state->c);
scm_t_uint32 m = H (x1) + L (x2) + L (x3) + H (state->c) + H (w);
scm_t_uint32 x4 = H (A) * H (state->w);
state->w = w = (L (m) << 16) + L (w);
state->c = H (x2) + H (x3) + x4 + H (m);
return w;
}
#endif
void
scm_i_init_rstate (scm_t_i_rstate *state, const char *seed, int n)
{

View file

@ -187,14 +187,10 @@ DEFINE_SRFI_4_PROXIES (s32);
DEFINE_SRFI_4_C_FUNCS (S32, s32, scm_t_int32, 1);
DEFINE_SRFI_4_PROXIES (u64);
#if SCM_HAVE_T_INT64
DEFINE_SRFI_4_C_FUNCS (U64, u64, scm_t_uint64, 1);
#endif
DEFINE_SRFI_4_PROXIES (s64);
#if SCM_HAVE_T_INT64
DEFINE_SRFI_4_C_FUNCS (S64, s64, scm_t_int64, 1);
#endif
DEFINE_SRFI_4_PROXIES (f32);
DEFINE_SRFI_4_C_FUNCS (F32, f32, float, 1);

View file

@ -2,7 +2,7 @@
#define SCM_SRFI_4_H
/* srfi-4.c --- Homogeneous numeric vector datatypes.
*
* Copyright (C) 2001, 2004, 2006, 2008, 2009 Free Software Foundation, Inc.
* Copyright (C) 2001, 2004, 2006, 2008, 2009, 2010 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
@ -161,7 +161,6 @@ SCM_API SCM scm_u64vector_to_list (SCM uvec);
SCM_API SCM scm_list_to_u64vector (SCM l);
SCM_API SCM scm_any_to_u64vector (SCM obj);
#if SCM_HAVE_T_UINT64
SCM_API SCM scm_take_u64vector (scm_t_uint64 *data, size_t n);
SCM_API const scm_t_uint64 *scm_array_handle_u64_elements (scm_t_array_handle *h);
SCM_API scm_t_uint64 *scm_array_handle_u64_writable_elements (scm_t_array_handle *h);
@ -173,7 +172,6 @@ SCM_API scm_t_uint64 *scm_u64vector_writable_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
#endif
SCM_API SCM scm_s64vector_p (SCM obj);
SCM_API SCM scm_make_s64vector (SCM n, SCM fill);
@ -185,7 +183,6 @@ SCM_API SCM scm_s64vector_to_list (SCM uvec);
SCM_API SCM scm_list_to_s64vector (SCM l);
SCM_API SCM scm_any_to_s64vector (SCM obj);
#if SCM_HAVE_T_INT64
SCM_API SCM scm_take_s64vector (scm_t_int64 *data, size_t n);
SCM_API const scm_t_int64 *scm_array_handle_s64_elements (scm_t_array_handle *h);
SCM_API scm_t_int64 *scm_array_handle_s64_writable_elements (scm_t_array_handle *h);
@ -196,7 +193,6 @@ SCM_API scm_t_int64 *scm_s64vector_writable_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
#endif
SCM_API SCM scm_f32vector_p (SCM obj);
SCM_API SCM scm_make_f32vector (SCM n, SCM fill);

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1999,2000,2001,2003,2004, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
/* Copyright (C) 1999,2000,2001,2003,2004, 2006, 2007, 2008, 2009, 2010 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
@ -702,10 +702,8 @@ DEFSTST (scm_to_int16)
DEFUTST (scm_to_uint16)
DEFSTST (scm_to_int32)
DEFUTST (scm_to_uint32)
#ifdef SCM_HAVE_T_INT64
DEFSTST (scm_to_int64)
DEFUTST (scm_to_uint64)
#endif
#define TEST_8S(v,f,r,re,te) test_8s (v, tst_##f, #f, r, re, te)
#define TEST_8U(v,f,r,re,te) test_8u (v, tst_##f, #f, r, re, te)
@ -745,11 +743,9 @@ test_int_sizes ()
TEST_7S (scm_from_int32, SCM_T_INT32_MAX+1LL, "-2147483648");
TEST_7U (scm_from_uint32, SCM_T_UINT32_MAX, "4294967295");
#if SCM_HAVE_T_INT64
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");
#endif
TEST_8S ("91", scm_to_schar, 91, 0, 0);
TEST_8U ("91", scm_to_uchar, 91, 0, 0);
@ -794,7 +790,6 @@ test_int_sizes ()
TEST_8U ("-1", scm_to_uint32, 0, 1, 0);
TEST_8U ("#f", scm_to_uint32, 0, 0, 1);
#if SCM_HAVE_T_INT64
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, 0, 1, 0);
@ -803,7 +798,6 @@ test_int_sizes ()
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);
#endif
}