Changeset 9db01c3 in git for libpolys


Ignore:
Timestamp:
Jul 26, 2018, 9:34:33 AM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'd08f5f0bb3329b8ca19f23b74cb1473686415c3a')
Children:
c63efbd28728cfbe9c13a3261352f43a1f82eb02
Parents:
1becad6a5d5cdf8123f9ba9b4b8b35707bc413a9
Message:
fix: 32/64-bit: CoeffName (rmodulo2m.cc)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/rmodulo2m.cc

    r1becad6 r9db01c3  
    6464static char* nr2mCoeffName(const coeffs cf)
    6565{
    66   static char n2mCoeffName_buf[22];
    67   snprintf(n2mCoeffName_buf,21,"ZZ/(2^%lu)",cf->modExponent);
     66  static char n2mCoeffName_buf[30];
     67  if (cf->modExponent>32) /* for 32/64bit arch.*/
     68    snprintf(n2mCoeffName_buf,21,"ZZ/(bigint(2)^%lu)",cf->modExponent);
     69  else
     70    snprintf(n2mCoeffName_buf,21,"ZZ/(2^%lu)",cf->modExponent);
    6871  return n2mCoeffName_buf;
    6972}
     
    7174static void    nr2mCoeffWrite  (const coeffs r, BOOLEAN /*details*/)
    7275{
    73   Print("ZZ/(2^%lu)", r->modExponent);
     76  PrintS(nr2mCoeffName(r));
    7477}
    7578
     
    8790static char* nr2mCoeffString(const coeffs r)
    8891{
    89   // r->modExponent <=bitsize(long)
    90   char* s = (char*) omAlloc(11+11);
    91   sprintf(s,"ZZ/(2^%lu)",r->modExponent);
    92   return s;
     92  return omStrDup(nr2mCoeffName(r));
    9393}
    9494
Note: See TracChangeset for help on using the changeset viewer.