My Project
Loading...
Searching...
No Matches
modulop_inl.h
Go to the documentation of this file.
1#ifndef MODULOP2_H
2#define MODULOP2_H
3/****************************************
4* Computer Algebra System SINGULAR *
5****************************************/
6/*
7* ABSTRACT: numbers modulo p (<=32749)
8*/
9#include "misc/auxiliary.h"
10#include "coeffs/modulop.h"
11
12static inline number npMult (number a,number b, const coeffs r)
13{
14 n_Test(a, r);
15 n_Test(b, r);
16
17 if (((long)a == 0) || ((long)b == 0))
18 return (number)0;
19 number c = npMultM(a,b, r);
20 n_Test(c, r);
21 return c;
22}
23
24/*2
25* create a number from int
26*/
27static inline number npInit (long i, const coeffs r)
28{
29 long ii=i % (long)r->ch;
30 if (ii < 0L) ii += (long)r->ch;
31
32 number c = (number)ii;
33 n_Test(c, r);
34 return c;
35}
36
37#define npIsZeroM(A,B) (0==(long)A)
38static inline BOOLEAN npIsZero (number a, const coeffs r)
39{
40 n_Test(a, r);
41
42 return npIsZeroM(a,r);
43}
44
45#ifdef NV_OPS
46// -----------------------------------------------------------
47// operation for very large primes (32749< p < 2^31-1)
48// ----------------------------------------------------------
49#pragma GCC diagnostic ignored "-Wlong-long"
50static inline number nvMult(number a, number b, const coeffs r)
51{
52 assume( getCoeffType(r) == n_Zp );
53
54#if SIZEOF_LONG == 4
55#define ULONG64 (unsigned long long)(unsigned long)
56#else
57#define ULONG64 (unsigned long)
58#endif
59 return (number)
60 (unsigned long)((ULONG64 a)*(ULONG64 b) % (ULONG64 r->ch));
61}
62#endif
63#endif
All the auxiliary stuff.
int BOOLEAN
Definition: auxiliary.h:87
int i
Definition: cfEzgcd.cc:132
CanonicalForm b
Definition: cfModGcd.cc:4103
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:709
@ n_Zp
\F{p < 2^31}
Definition: coeffs.h:29
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
if(!FE_OPT_NO_SHELL_FLAG)(void) system(sys)
#define assume(x)
Definition: mod2.h:389
static number npMultM(number a, number b, const coeffs r)
Definition: modulop.h:71
static number npInit(long i, const coeffs r)
Definition: modulop_inl.h:27
static number nvMult(number a, number b, const coeffs r)
Definition: modulop_inl.h:50
#define ULONG64
static number npMult(number a, number b, const coeffs r)
Definition: modulop_inl.h:12
static BOOLEAN npIsZero(number a, const coeffs r)
Definition: modulop_inl.h:38
#define npIsZeroM(A, B)
Definition: modulop_inl.h:37
The main handler for Singular numbers which are suitable for Singular polynomials.