From 35d12ee9e7a7360989e662d8d59f256a0824ed71 Mon Sep 17 00:00:00 2001 From: Dominik Bernhardt Date: Tue, 2 Apr 2019 10:01:37 +0200 Subject: [PATCH] Fix 64Bit Cyclotomic Size limit Add test case for 2^32 Adjust test for 32bit systems --- doc/ref/cyclotom.xml | 2 +- src/cyclotom.c | 2 +- tst/testinstall/cyclotom.tst | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/ref/cyclotom.xml b/doc/ref/cyclotom.xml index c5046b3a0f..602a402e3b 100644 --- a/doc/ref/cyclotom.xml +++ b/doc/ref/cyclotom.xml @@ -202,7 +202,7 @@ This can be raised (although not lowered) using and accessed using . The maximum value of the limit is 2^{28}-1 on 32 bit systems, -and 2^{32} on 64 bit systems. +and 2^{32}-1 on 64 bit systems. So the maximal cyclotomic field implemented in ⪆ is not really the field &QQ;^{ab}.

diff --git a/src/cyclotom.c b/src/cyclotom.c index 7a3d6ca966..219084ee76 100644 --- a/src/cyclotom.c +++ b/src/cyclotom.c @@ -854,7 +854,7 @@ static Obj FuncSetCyclotomicsLimit(Obj self, Obj newlimit) CyclotomicsLimit, 0); } #ifdef SYS_IS_64_BIT - if (ulimit > (1L << 32)) { + if (ulimit >= (1L << 32)) { ErrorMayQuit("Cyclotomic field size limit must be less than 2^32", 0, 0); } diff --git a/tst/testinstall/cyclotom.tst b/tst/testinstall/cyclotom.tst index 4fa05f8d9d..0cc863f3e4 100644 --- a/tst/testinstall/cyclotom.tst +++ b/tst/testinstall/cyclotom.tst @@ -276,6 +276,10 @@ he integer 0) gap> SetCyclotomicsLimit(100); Error, SetCyclotomicsLimit: must not be less than old limit of 1000\ 000 +#@if 8*GAPInfo.BytesPerVariable = 64 +gap> SetCyclotomicsLimit(2^32); +Error, Cyclotomic field size limit must be less than 2^32 +#@fi gap> SetCyclotomicsLimit(1000000); #