Changeset 6c56a8 in git


Ignore:
Timestamp:
Nov 2, 2005, 9:39:36 AM (18 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
2d9e1e4f8660799bb716297574a573cc2f41db66
Parents:
b40db551cdfbadb596186acf701ca9bb193fae63
Message:
*hannes: 64bit and gcc


git-svn-id: file:///usr/local/Singular/svn/trunk@8774 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/modulop.h

    rb40db5 r6c56a8  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: modulop.h,v 1.1.1.1 2003-10-06 12:15:58 Singular Exp $ */
     6/* $Id: modulop.h,v 1.2 2005-11-02 08:39:36 Singular Exp $ */
    77/*
    88* ABSTRACT: numbers modulo p (<=32003)
     
    9090static inline number npMultM(number a, number b)
    9191{
    92   int x = npLogTable[(long)a]+npLogTable[(long)b];
     92  long x = (long)npLogTable[(long)a]+npLogTable[(long)b];
    9393  return (number)npExpTable[x<npPminus1M ? x : x-npPminus1M];
    9494}
     
    123123static inline number npSubM(number a, number b)
    124124{
    125   return (number)((int)a<(int)b ?
    126                        npPrimeM-(int)b+(int)a : (int)a-(int)b);
     125  return (number)((long)a<(long)b ?
     126                       npPrimeM-(long)b+(long)a : (long)a-(long)b);
    127127}
    128128#else
    129129static inline number npAddM(number a, number b)
    130130{
    131    int res = (int)((long)a + (long)b);
     131   long res = ((long)a + (long)b);
    132132   res -= npPrimeM;
     133#if SIZEOF_LONG == 8
     134   res += (res >> 63) & npPrimeM;
     135#else
    133136   res += (res >> 31) & npPrimeM;
     137#endif
    134138   return (number)res;
    135139}
    136140static inline number npSubM(number a, number b)
    137141{
    138    int res = (int)((long)a - (long)b);
     142   long res = ((long)a - (long)b);
     143#if SIZEOF_LONG == 8
     144   res += (res >> 63) & npPrimeM;
     145#else
    139146   res += (res >> 31) & npPrimeM;
     147#endif
    140148   return (number)res;
    141149}
Note: See TracChangeset for help on using the changeset viewer.