forked from mirrors/nixpkgs
36 lines
1.5 KiB
Diff
36 lines
1.5 KiB
Diff
|
diff --git a/kernel/GBEngine/kChinese.cc b/kernel/GBEngine/kChinese.cc
|
||
|
index 829a66609..84655caf2 100644
|
||
|
--- a/kernel/GBEngine/kChinese.cc
|
||
|
+++ b/kernel/GBEngine/kChinese.cc
|
||
|
@@ -209,6 +209,8 @@ ideal id_ChineseRemainder_0(ideal *xx, number *q, int rl, const ring r)
|
||
|
return NULL;
|
||
|
}
|
||
|
int cpus=(int)(long)feOptValue(FE_OPT_CPUS);
|
||
|
+ if (cpus>=vspace::internals::MAX_PROCESS)
|
||
|
+ cpus=vspace::internals::MAX_PROCESS-1;
|
||
|
if ((cpus==1) || (2*cpus>=cnt))
|
||
|
/* at least 2 polys for each process, or switch to seriell version */
|
||
|
return id_ChineseRemainder(xx,q,rl,r);
|
||
|
@@ -295,6 +297,8 @@ ideal id_Farey_0(ideal x, number N, const ring r)
|
||
|
{
|
||
|
int cnt=IDELEMS(x)*x->nrows;
|
||
|
int cpus=(int)(long)feOptValue(FE_OPT_CPUS);
|
||
|
+ if (cpus>=vspace::internals::MAX_PROCESS)
|
||
|
+ cpus=vspace::internals::MAX_PROCESS-1;
|
||
|
if (2*cpus>=cnt) /* at least 2 polys for each process,
|
||
|
or switch to seriell version */
|
||
|
return id_Farey(x,N,r);
|
||
|
diff --git a/kernel/GBEngine/kverify.cc b/kernel/GBEngine/kverify.cc
|
||
|
index 909d84994..aa06d6624 100644
|
||
|
--- a/kernel/GBEngine/kverify.cc
|
||
|
+++ b/kernel/GBEngine/kverify.cc
|
||
|
@@ -176,6 +176,8 @@ BOOLEAN kVerify2(ideal F, ideal Q)
|
||
|
/*---------------------------------------------------------------------*/
|
||
|
BOOLEAN all_okay=TRUE;
|
||
|
int cpus=(int)(long)feOptValue(FE_OPT_CPUS);
|
||
|
+ if (cpus>=vspace::internals::MAX_PROCESS)
|
||
|
+ cpus=vspace::internals::MAX_PROCESS-1;
|
||
|
int parent_pid=getpid();
|
||
|
using namespace vspace;
|
||
|
vmem_init();
|