X-Git-Url: https://git.hcoop.net/bpt/guile.git/blobdiff_plain/db18a252fb4910017808878b3b8e2dfeda1ccdd0..01a8d00ca331f64d5f9337409c339998155596d2:/libguile/numbers.h?ds=sidebyside diff --git a/libguile/numbers.h b/libguile/numbers.h index cef2b863b..6e382ea35 100644 --- a/libguile/numbers.h +++ b/libguile/numbers.h @@ -3,7 +3,8 @@ #ifndef SCM_NUMBERS_H #define SCM_NUMBERS_H -/* Copyright (C) 1995,1996,1998,2000,2001,2002,2003,2004,2005, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1998,2000,2001,2002,2003,2004,2005, 2006, + * 2008, 2009, 2010, 2011, 2013 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 @@ -204,7 +205,8 @@ SCM_API SCM scm_logbit_p (SCM n1, SCM n2); SCM_API SCM scm_lognot (SCM n); SCM_API SCM scm_modulo_expt (SCM n, SCM k, SCM m); SCM_API SCM scm_integer_expt (SCM z1, SCM z2); -SCM_API SCM scm_ash (SCM n, SCM cnt); +SCM_API SCM scm_ash (SCM n, SCM count); +SCM_API SCM scm_round_ash (SCM n, SCM count); SCM_API SCM scm_bit_extract (SCM n, SCM start, SCM end); SCM_API SCM scm_logcount (SCM n); SCM_API SCM scm_integer_length (SCM n); @@ -240,6 +242,7 @@ SCM_API SCM scm_complex_p (SCM x); SCM_API SCM scm_real_p (SCM x); SCM_API SCM scm_rational_p (SCM z); SCM_API SCM scm_integer_p (SCM x); +SCM_API SCM scm_exact_integer_p (SCM x); SCM_API SCM scm_inexact_p (SCM x); SCM_API int scm_is_inexact (SCM x); SCM_API SCM scm_num_eq_p (SCM x, SCM y); @@ -328,6 +331,7 @@ SCM_INTERNAL void scm_i_print_complex (double real, double imag, SCM port); /* conversion functions for integers */ SCM_API int scm_is_integer (SCM val); +SCM_API int scm_is_exact_integer (SCM val); SCM_API int scm_is_signed_integer (SCM val, scm_t_intmax min, scm_t_intmax max); SCM_API int scm_is_unsigned_integer (SCM val, @@ -500,6 +504,46 @@ SCM_API SCM scm_from_mpz (mpz_t rop); #endif #endif +#if SCM_SIZEOF_SCM_T_PTRDIFF == 4 +#define scm_to_ptrdiff_t scm_to_int32 +#define scm_from_ptrdiff_t scm_from_int32 +#else +#if SCM_SIZEOF_SCM_T_PTRDIFF == 8 +#define scm_to_ptrdiff_t scm_to_int64 +#define scm_from_ptrdiff_t scm_from_int64 +#else +#error sizeof(scm_t_ptrdiff) is not 4 or 8. +#endif +#endif + +#if SCM_SIZEOF_INTPTR_T == 0 +/* No intptr_t; use size_t functions. */ +#define scm_to_intptr_t scm_to_ssize_t +#define scm_from_intptr_t scm_from_ssize_t +#elif SCM_SIZEOF_INTPTR_T == 4 +#define scm_to_intptr_t scm_to_int32 +#define scm_from_intptr_t scm_from_int32 +#elif SCM_SIZEOF_INTPTR_T == 8 +#define scm_to_intptr_t scm_to_int64 +#define scm_from_intptr_t scm_from_int64 +#else +#error sizeof(intptr_t) is not 4 or 8. +#endif + +#if SCM_SIZEOF_UINTPTR_T == 0 +/* No uintptr_t; use size_t functions. */ +#define scm_to_uintptr_t scm_to_size_t +#define scm_from_uintptr_t scm_from_size_t +#elif SCM_SIZEOF_UINTPTR_T == 4 +#define scm_to_uintptr_t scm_to_uint32 +#define scm_from_uintptr_t scm_from_uint32 +#elif SCM_SIZEOF_UINTPTR_T == 8 +#define scm_to_uintptr_t scm_to_uint64 +#define scm_from_uintptr_t scm_from_uint64 +#else +#error sizeof(uintptr_t) is not 4 or 8. +#endif + /* conversion functions for double */ SCM_API int scm_is_real (SCM val);