[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 52/85: Implement scm_{to,from}_wchar inline
From: |
Andy Wingo |
Subject: |
[Guile-commits] 52/85: Implement scm_{to,from}_wchar inline |
Date: |
Thu, 13 Jan 2022 03:40:22 -0500 (EST) |
wingo pushed a commit to branch main
in repository guile.
commit 106c5de5fc3a4858f36a7acdd67f369e21dcee01
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] 38/85: Clean up <, reimplement in terms of integer lib, (continued)
- [Guile-commits] 38/85: Clean up <, reimplement in terms of integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 39/85: positive?, negative? use integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 41/85: Clean up scm_sum, Andy Wingo, 2022/01/13
- [Guile-commits] 43/85: Simplify scm_product, use integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 44/85: Remove support for allowing exact numbers to be divided by zero, Andy Wingo, 2022/01/13
- [Guile-commits] 45/85: Clean up scm_divide, Andy Wingo, 2022/01/13
- [Guile-commits] 46/85: Fix deprecated bit-count* when counting 0 bits, Andy Wingo, 2022/01/13
- [Guile-commits] 48/85: Reimplement scm_is_{un, }signed_integer for bignums, Andy Wingo, 2022/01/13
- [Guile-commits] 54/85: scm_to_mpz uses integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 51/85: Reimplement scm_{to,from}_{int64,uint64}, Andy Wingo, 2022/01/13
- [Guile-commits] 52/85: Implement scm_{to,from}_wchar inline,
Andy Wingo <=
- [Guile-commits] 58/85: Remove dead bignum frexp code from numbers.c, Andy Wingo, 2022/01/13
- [Guile-commits] 53/85: Remove unused conv-{u,}integer.i.c, Andy Wingo, 2022/01/13
- [Guile-commits] 63/85: Use scm_integer_to_double_z in numbers.c instead of big2dbl, Andy Wingo, 2022/01/13
- [Guile-commits] 66/85: Finish srfi-60 port off old scm mpz API, Andy Wingo, 2022/01/13
- [Guile-commits] 74/85: Less pessimal scm_integer_sub_zi, Andy Wingo, 2022/01/13
- [Guile-commits] 76/85: Avoid bignum clone in scm_integer_sub_zz, Andy Wingo, 2022/01/13
- [Guile-commits] 79/85: Optimize scm_integer_mul_ii, Andy Wingo, 2022/01/13
- [Guile-commits] 80/85: Optimize integer-expt for fixnums, Andy Wingo, 2022/01/13
- [Guile-commits] 81/85: Optimize logand against a positive inum, Andy Wingo, 2022/01/13
- [Guile-commits] 82/85: Simplify scm_abs for the real case, Andy Wingo, 2022/01/13