[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 53/69: Implement scm_{to,from}_wchar inline
From: |
Andy Wingo |
Subject: |
[Guile-commits] 53/69: Implement scm_{to,from}_wchar inline |
Date: |
Fri, 7 Jan 2022 08:27:18 -0500 (EST) |
wingo pushed a commit to branch wip-inline-digits
in repository guile.
commit 1b14d58a644922485118ef7a7bc6a49cf80337ef
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Thu Jan 6 21:15:16 2022 +0100
Implement scm_{to,from}_wchar inline
* libguile/numbers.c (scm_to_wchar, scm_from_wchar): Implement inline.
---
libguile/numbers.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 9ea860600..10efb303a 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -7072,13 +7072,17 @@ scm_from_uint64 (uint64_t arg)
return scm_integer_from_uint64 (arg);
}
-#define TYPE scm_t_wchar
-#define TYPE_MIN (int32_t)-1
-#define TYPE_MAX (int32_t)0x10ffff
-#define SIZEOF_TYPE 4
-#define SCM_TO_TYPE_PROTO(arg) scm_to_wchar (arg)
-#define SCM_FROM_TYPE_PROTO(arg) scm_from_wchar (arg)
-#include "conv-integer.i.c"
+wchar_t
+scm_to_wchar (SCM arg)
+{
+ return inum_in_range (arg, -1, 0x10ffff);
+}
+
+SCM
+scm_from_wchar (wchar_t arg)
+{
+ return SCM_I_MAKINUM (arg);
+}
void
scm_to_mpz (SCM val, mpz_t rop)
- [Guile-commits] 06/69: Implement floor-remainder with new integer lib, (continued)
- [Guile-commits] 06/69: Implement floor-remainder with new integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 14/69: Implement centered-quotient with new integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 11/69: Implement truncate-quotient with new integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 13/69: Implement truncate-divide with new integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 31/69: Implement scm_bit_extract with new integer library, Andy Wingo, 2022/01/07
- [Guile-commits] 34/69: Implement scm_integer_length with new integer library, Andy Wingo, 2022/01/07
- [Guile-commits] 42/69: Clean up scm_sum, Andy Wingo, 2022/01/07
- [Guile-commits] 43/69: Simplify scm_difference, use integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 44/69: Simplify scm_product, use integer lib, Andy Wingo, 2022/01/07
- [Guile-commits] 52/69: Reimplement scm_{to,from}_{int64,uint64}, Andy Wingo, 2022/01/07
- [Guile-commits] 53/69: Implement scm_{to,from}_wchar inline,
Andy Wingo <=
- [Guile-commits] 60/69: divide2double refactor, Andy Wingo, 2022/01/07
- [Guile-commits] 65/69: Avoid scm_i_mkbig outside numbers.c., Andy Wingo, 2022/01/07
- [Guile-commits] 57/69: Refactor scm_sqrt in terms of integers.[ch], Andy Wingo, 2022/01/07
- [Guile-commits] 59/69: Remove dead bignum frexp code from numbers.c, Andy Wingo, 2022/01/07
- [Guile-commits] 47/69: Fix deprecated bit-count* when counting 0 bits, Andy Wingo, 2022/01/07
- [Guile-commits] 49/69: Reimplement scm_is_{un, }signed_integer for bignums, Andy Wingo, 2022/01/07
- [Guile-commits] 51/69: Reimplement scm_{to,from}_{int32,uint32}, Andy Wingo, 2022/01/07
- [Guile-commits] 45/69: Remove support for allowing exact numbers to be divided by zero, Andy Wingo, 2022/01/07
- [Guile-commits] 50/69: Reimplement scm_from_int8 etc, Andy Wingo, 2022/01/07
- [Guile-commits] 56/69: Reimplement exact-integer-sqrt with integers.[ch], Andy Wingo, 2022/01/07