[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/85: Add new integers.[ch]
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/85: Add new integers.[ch] |
Date: |
Thu, 13 Jan 2022 03:40:07 -0500 (EST) |
wingo pushed a commit to branch main
in repository guile.
commit c768115d93cf5535b19770831c142704128c0991
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Thu Dec 2 13:55:07 2021 +0100
Add new integers.[ch]
The goal is to factor out some fixnum/bignum code here from
numbers.[ch].
* libguile/Makefile.am: Add new files.
* libguile/integers.c:
* libguile/integers.h: New files
---
libguile/Makefile.am | 4 +++-
libguile/integers.c | 35 +++++++++++++++++++++++++++++++++++
libguile/integers.h | 28 ++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/libguile/Makefile.am b/libguile/Makefile.am
index 3568767af..a06f950de 100644
--- a/libguile/Makefile.am
+++ b/libguile/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with Automake to create Makefile.in
##
-## Copyright (C) 1998-2004, 2006-2014, 2016-2020
+## Copyright (C) 1998-2004, 2006-2014, 2016-2021
## Free Software Foundation, Inc.
##
## This file is part of GUILE.
@@ -174,6 +174,7 @@ libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES =
\
init.c \
inline.c \
instructions.c \
+ integers.c \
intrinsics.c \
ioext.c \
jit.c \
@@ -528,6 +529,7 @@ uninstall-hook:
## working.
noinst_HEADERS = conv-integer.i.c conv-uinteger.i.c \
elf.h \
+ integers.h \
intrinsics.h \
srfi-14.i.c \
quicksort.i.c \
diff --git a/libguile/integers.c b/libguile/integers.c
new file mode 100644
index 000000000..d19c4450e
--- /dev/null
+++ b/libguile/integers.c
@@ -0,0 +1,35 @@
+/* Copyright 1995-2016,2018-2021
+ Free Software Foundation, Inc.
+
+ This file is part of Guile.
+
+ Guile is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Guile is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with Guile. If not, see
+ <https://www.gnu.org/licenses/>. */
+
+
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <verify.h>
+
+#include "numbers.h"
+
+#include "integers.h"
+
+/* Some functions that use GMP's mpn functions assume that a
+ non-negative fixnum will always fit in a 'mp_limb_t'. */
+verify (SCM_MOST_POSITIVE_FIXNUM <= (mp_limb_t) -1);
+
diff --git a/libguile/integers.h b/libguile/integers.h
new file mode 100644
index 000000000..ac0a0f325
--- /dev/null
+++ b/libguile/integers.h
@@ -0,0 +1,28 @@
+#ifndef SCM_INTEGERS_H
+#define SCM_INTEGERS_H
+
+/* Copyright 2021 Free Software Foundation, Inc.
+
+ This file is part of Guile.
+
+ Guile is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Guile is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with Guile. If not, see
+ <https://www.gnu.org/licenses/>. */
+
+
+
+/* Contents go here. */
+
+
+
+#endif /* SCM_INTEGERS_H */
- [Guile-commits] branch main updated (52e310a2a -> 222b32086), Andy Wingo, 2022/01/13
- [Guile-commits] 02/85: Implement odd? and even? with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 01/85: Add new integers.[ch],
Andy Wingo <=
- [Guile-commits] 05/85: Implement floor-remainder with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 03/85: Implement abs with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 04/85: Implement floor-quotient with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 06/85: Implement floor-divide with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 07/85: Implement ceiling-quotient with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 18/85: Implement round-divide with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 27/85: Implement scm_modulo_expt with new integer library, Andy Wingo, 2022/01/13
- [Guile-commits] 17/85: Implement round-remainder with new integer lib, Andy Wingo, 2022/01/13
- [Guile-commits] 21/85: Implement scm_logand with new integer library, Andy Wingo, 2022/01/13
- [Guile-commits] 16/85: Implement round-quotient with new integer lib, Andy Wingo, 2022/01/13