guile-commits
[Top][All Lists]
Advanced

[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 */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]