1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-19 02:00:26 +02:00

Implement scm_logtest with new integer library

* libguile/integers.c (scm_integer_logtest_ii, scm_integer_logtest_zi)
(scm_integer_logtest_zz): New internal functions.
* libguile/integers.h: Declare the new internal functions.
* libguile/numbers.c (scm_logtest): Use new internal functions.
This commit is contained in:
Andy Wingo 2021-12-19 10:54:47 +01:00
parent 459163fca1
commit 6298d73115
3 changed files with 28 additions and 39 deletions

View file

@ -27,6 +27,7 @@
#include <stdio.h>
#include <verify.h>
#include "boolean.h"
#include "numbers.h"
#include "integers.h"
@ -1989,3 +1990,21 @@ scm_integer_logxor_zz (SCM x, SCM y)
scm_remember_upto_here_2 (x, y);
return take_mpz (result);
}
int
scm_integer_logtest_ii (scm_t_inum x, scm_t_inum y)
{
return (x & y) ? 1 : 0;
}
int
scm_integer_logtest_zi (SCM x, scm_t_inum y)
{
return scm_is_eq (scm_integer_logand_zi (x, y), SCM_INUM0);
}
int
scm_integer_logtest_zz (SCM x, SCM y)
{
return scm_is_eq (scm_integer_logand_zz (x, y), SCM_INUM0);
}