1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

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
This commit is contained in:
Andy Wingo 2021-12-02 13:55:07 +01:00
parent 52e310a2ac
commit c768115d93
3 changed files with 66 additions and 1 deletions

View file

@ -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 \

35
libguile/integers.c Normal file
View file

@ -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);

28
libguile/integers.h Normal file
View file

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