Changeset 4ecee2 in git
- Timestamp:
- Nov 25, 2000, 9:30:19 PM (23 years ago)
- Branches:
- (u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
- Children:
- fa8c7a7fb5cc720d8d29edced3eb44edabfc631b
- Parents:
- 949cae53b67a55ec9c09d7ea7d86a5630a2ca9f4
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/modulop.cc
r949cae r4ecee2 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: modulop.cc,v 1.2 0 2000-11-17 14:07:11 SingularExp $ */4 /* $Id: modulop.cc,v 1.21 2000-11-25 20:30:19 obachman Exp $ */ 5 5 /* 6 6 * ABSTRACT: numbers modulo p (<=32003) … … 26 26 CARDINAL *npLogTable=NULL; 27 27 28 28 29 BOOLEAN npGreaterZero (number k) 29 30 { 30 31 int h = (int) k; 31 32 return ((int)h !=0) && (h <= (npPrimeM>>1)); 33 } 34 35 unsigned long npMultMod(unsigned long a, unsigned long b) 36 { 37 unsigned long c = a*b; 38 c = c % npPrimeM; 39 assume(c == (unsigned long) npMultM((number) a, (number) b)); 40 return c; 32 41 } 33 42 -
Singular/modulop.h
r949cae r4ecee2 4 4 * Computer Algebra System SINGULAR * 5 5 ****************************************/ 6 /* $Id: modulop.h,v 1.1 1 2000-11-16 16:52:37 SingularExp $ */6 /* $Id: modulop.h,v 1.12 2000-11-25 20:30:18 obachman Exp $ */ 7 7 /* 8 8 * ABSTRACT: numbers modulo p (<=32003) 9 9 */ 10 10 #include "structs.h" 11 12 // define if a*b is with mod instead of tables 13 #define HAVE_MULT_MOD 11 14 12 15 extern int npPrimeM; … … 47 50 extern CARDINAL *npLogTable; 48 51 52 #ifdef HAVE_MULT_MOD 53 inline number npMultM(number a, number b) 54 { 55 return (number) 56 ((((unsigned long) a)*((unsigned long) b)) % ((unsigned long) npPrimeM)); 57 } 58 #else 49 59 inline number npMultM(number a, number b) 50 60 { … … 52 62 return (number)npExpTable[x<npPminus1M ? x : x-npPminus1M]; 53 63 } 64 #endif 54 65 55 66 #if 0
Note: See TracChangeset
for help on using the changeset viewer.