Browse Source

Janitorial clean-up.

Remove some unused variables and convert files with CRNL line endings
to files with NL line endings.
master
Richard Kreckel 11 years ago
parent
commit
8d1111ad1f
  1. 2
      src/complex/input/cl_N_read.cc
  2. 2
      src/float/input/cl_F_read.cc
  3. 404
      src/integer/conv/cl_I_cached_power.cc
  4. 94
      src/integer/conv/cl_I_cached_power.h
  5. 2
      src/real/input/cl_R_read.cc

2
src/complex/input/cl_N_read.cc

@ -164,13 +164,11 @@ not_rational_syntax:
} }
var const char * ptr_after_sign = ptr; var const char * ptr_after_sign = ptr;
var const char * ptr_after_intpart = skip_digits(ptr_after_sign,string_limit,float_base); var const char * ptr_after_intpart = skip_digits(ptr_after_sign,string_limit,float_base);
var bool have_dot = false;
var const char * ptr_before_fracpart = ptr_after_intpart; var const char * ptr_before_fracpart = ptr_after_intpart;
var const char * ptr_after_fracpart = ptr_after_intpart; var const char * ptr_after_fracpart = ptr_after_intpart;
ptr = ptr_after_intpart; ptr = ptr_after_intpart;
if (ptr != string_limit) if (ptr != string_limit)
if (*ptr == '.') { if (*ptr == '.') {
have_dot = true;
ptr_before_fracpart = ptr+1; ptr_before_fracpart = ptr+1;
ptr_after_fracpart = skip_digits(ptr_before_fracpart,string_limit,float_base); ptr_after_fracpart = skip_digits(ptr_before_fracpart,string_limit,float_base);
} }

2
src/float/input/cl_F_read.cc

@ -75,13 +75,11 @@ const cl_F read_float (const cl_read_flags& flags, const char * string, const ch
} }
var const char * ptr_after_sign = ptr; var const char * ptr_after_sign = ptr;
var const char * ptr_after_intpart = skip_digits(ptr_after_sign,string_limit,float_base); var const char * ptr_after_intpart = skip_digits(ptr_after_sign,string_limit,float_base);
var bool have_dot = false;
var const char * ptr_before_fracpart = ptr_after_intpart; var const char * ptr_before_fracpart = ptr_after_intpart;
var const char * ptr_after_fracpart = ptr_after_intpart; var const char * ptr_after_fracpart = ptr_after_intpart;
ptr = ptr_after_intpart; ptr = ptr_after_intpart;
if (ptr != string_limit) if (ptr != string_limit)
if (*ptr == '.') { if (*ptr == '.') {
have_dot = true;
ptr_before_fracpart = ptr+1; ptr_before_fracpart = ptr+1;
ptr_after_fracpart = skip_digits(ptr_before_fracpart,string_limit,float_base); ptr_after_fracpart = skip_digits(ptr_before_fracpart,string_limit,float_base);
} }

404
src/integer/conv/cl_I_cached_power.cc

@ -1,202 +1,202 @@
// cached_power(). // cached_power().
// Specification.
// Specification. #include "integer/conv/cl_I_cached_power.h"
#include "integer/conv/cl_I_cached_power.h" // Implementation.
namespace cln {
const power_table_entry power_table [36-2+1] = {
// Implementation. #if (intDsize==8)
{ 7, 2*2*2*2*2*2*2 },
namespace cln { { 5, 3*3*3*3*3 },
{ 3, 4*4*4 },
const power_table_entry power_table [36-2+1] = { { 3, 5*5*5 },
#if (intDsize==8) { 3, 6*6*6 },
{ 7, 2*2*2*2*2*2*2 }, { 2, 7*7 },
{ 5, 3*3*3*3*3 }, { 2, 8*8 },
{ 3, 4*4*4 }, { 2, 9*9 },
{ 3, 5*5*5 }, { 2, 10*10 },
{ 3, 6*6*6 }, { 2, 11*11 },
{ 2, 7*7 }, { 2, 12*12 },
{ 2, 8*8 }, { 2, 13*13 },
{ 2, 9*9 }, { 2, 14*14 },
{ 2, 10*10 }, { 2, 15*15 },
{ 2, 11*11 }, { 1, 16 },
{ 2, 12*12 }, { 1, 17 },
{ 2, 13*13 }, { 1, 18 },
{ 2, 14*14 }, { 1, 19 },
{ 2, 15*15 }, { 1, 20 },
{ 1, 16 }, { 1, 21 },
{ 1, 17 }, { 1, 22 },
{ 1, 18 }, { 1, 23 },
{ 1, 19 }, { 1, 24 },
{ 1, 20 }, { 1, 25 },
{ 1, 21 }, { 1, 26 },
{ 1, 22 }, { 1, 27 },
{ 1, 23 }, { 1, 28 },
{ 1, 24 }, { 1, 29 },
{ 1, 25 }, { 1, 30 },
{ 1, 26 }, { 1, 31 },
{ 1, 27 }, { 1, 32 },
{ 1, 28 }, { 1, 33 },
{ 1, 29 }, { 1, 34 },
{ 1, 30 }, { 1, 35 },
{ 1, 31 }, { 1, 36 },
{ 1, 32 }, #endif
{ 1, 33 }, #if (intDsize==16)
{ 1, 34 }, { 15, 2*2*2*2*2*2*2*2*2*2*2*2*2*2*2 },
{ 1, 35 }, { 10, 3*3*3*3*3*3*3*3*3*3 },
{ 1, 36 }, { 7, 4*4*4*4*4*4*4 },
#endif { 6, 5*5*5*5*5*5 },
#if (intDsize==16) { 6, 6*6*6*6*6*6 },
{ 15, 2*2*2*2*2*2*2*2*2*2*2*2*2*2*2 }, { 5, 7*7*7*7*7 },
{ 10, 3*3*3*3*3*3*3*3*3*3 }, { 5, 8*8*8*8*8 },
{ 7, 4*4*4*4*4*4*4 }, { 5, 9*9*9*9*9 },
{ 6, 5*5*5*5*5*5 }, { 4, 10*10*10*10 },
{ 6, 6*6*6*6*6*6 }, { 4, 11*11*11*11 },
{ 5, 7*7*7*7*7 }, { 4, 12*12*12*12 },
{ 5, 8*8*8*8*8 }, { 4, 13*13*13*13 },
{ 5, 9*9*9*9*9 }, { 4, 14*14*14*14 },
{ 4, 10*10*10*10 }, { 4, 15*15*15*15 },
{ 4, 11*11*11*11 }, { 3, 16*16*16 },
{ 4, 12*12*12*12 }, { 3, 17*17*17 },
{ 4, 13*13*13*13 }, { 3, 18*18*18 },
{ 4, 14*14*14*14 }, { 3, 19*19*19 },
{ 4, 15*15*15*15 }, { 3, 20*20*20 },
{ 3, 16*16*16 }, { 3, 21*21*21 },
{ 3, 17*17*17 }, { 3, 22*22*22 },
{ 3, 18*18*18 }, { 3, 23*23*23 },
{ 3, 19*19*19 }, { 3, 24*24*24 },
{ 3, 20*20*20 }, { 3, 25*25*25 },
{ 3, 21*21*21 }, { 3, 26*26*26 },
{ 3, 22*22*22 }, { 3, 27*27*27 },
{ 3, 23*23*23 }, { 3, 28*28*28 },
{ 3, 24*24*24 }, { 3, 29*29*29 },
{ 3, 25*25*25 }, { 3, 30*30*30 },
{ 3, 26*26*26 }, { 3, 31*31*31 },
{ 3, 27*27*27 }, { 3, 32*32*32 },
{ 3, 28*28*28 }, { 3, 33*33*33 },
{ 3, 29*29*29 }, { 3, 34*34*34 },
{ 3, 30*30*30 }, { 3, 35*35*35 },
{ 3, 31*31*31 }, { 3, 36*36*36 },
{ 3, 32*32*32 }, #endif
{ 3, 33*33*33 }, #if (intDsize==32)
{ 3, 34*34*34 }, { 31, 2UL*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2 },
{ 3, 35*35*35 }, { 20, 3UL*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3 },
{ 3, 36*36*36 }, { 15, 4UL*4*4*4*4*4*4*4*4*4*4*4*4*4*4 },
#endif { 13, 5UL*5*5*5*5*5*5*5*5*5*5*5*5 },
#if (intDsize==32) { 12, 6UL*6*6*6*6*6*6*6*6*6*6*6 },
{ 31, 2UL*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2 }, { 11, 7UL*7*7*7*7*7*7*7*7*7*7 },
{ 20, 3UL*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3 }, { 10, 8UL*8*8*8*8*8*8*8*8*8 },
{ 15, 4UL*4*4*4*4*4*4*4*4*4*4*4*4*4*4 }, { 10, 9UL*9*9*9*9*9*9*9*9*9 },
{ 13, 5UL*5*5*5*5*5*5*5*5*5*5*5*5 }, { 9, 10UL*10*10*10*10*10*10*10*10 },
{ 12, 6UL*6*6*6*6*6*6*6*6*6*6*6 }, { 9, 11UL*11*11*11*11*11*11*11*11 },
{ 11, 7UL*7*7*7*7*7*7*7*7*7*7 }, { 8, 12UL*12*12*12*12*12*12*12 },
{ 10, 8UL*8*8*8*8*8*8*8*8*8 }, { 8, 13UL*13*13*13*13*13*13*13 },
{ 10, 9UL*9*9*9*9*9*9*9*9*9 }, { 8, 14UL*14*14*14*14*14*14*14 },
{ 9, 10UL*10*10*10*10*10*10*10*10 }, { 8, 15UL*15*15*15*15*15*15*15 },
{ 9, 11UL*11*11*11*11*11*11*11*11 }, { 7, 16UL*16*16*16*16*16*16 },
{ 8, 12UL*12*12*12*12*12*12*12 }, { 7, 17UL*17*17*17*17*17*17 },
{ 8, 13UL*13*13*13*13*13*13*13 }, { 7, 18UL*18*18*18*18*18*18 },
{ 8, 14UL*14*14*14*14*14*14*14 }, { 7, 19UL*19*19*19*19*19*19 },
{ 8, 15UL*15*15*15*15*15*15*15 }, { 7, 20UL*20*20*20*20*20*20 },
{ 7, 16UL*16*16*16*16*16*16 }, { 7, 21UL*21*21*21*21*21*21 },
{ 7, 17UL*17*17*17*17*17*17 }, { 7, 22UL*22*22*22*22*22*22 },
{ 7, 18UL*18*18*18*18*18*18 }, { 7, 23UL*23*23*23*23*23*23 },
{ 7, 19UL*19*19*19*19*19*19 }, { 6, 24UL*24*24*24*24*24 },
{ 7, 20UL*20*20*20*20*20*20 }, { 6, 25UL*25*25*25*25*25 },
{ 7, 21UL*21*21*21*21*21*21 }, { 6, 26UL*26*26*26*26*26 },
{ 7, 22UL*22*22*22*22*22*22 }, { 6, 27UL*27*27*27*27*27 },
{ 7, 23UL*23*23*23*23*23*23 }, { 6, 28UL*28*28*28*28*28 },
{ 6, 24UL*24*24*24*24*24 }, { 6, 29UL*29*29*29*29*29 },
{ 6, 25UL*25*25*25*25*25 }, { 6, 30UL*30*30*30*30*30 },
{ 6, 26UL*26*26*26*26*26 }, { 6, 31UL*31*31*31*31*31 },
{ 6, 27UL*27*27*27*27*27 }, { 6, 32UL*32*32*32*32*32 },
{ 6, 28UL*28*28*28*28*28 }, { 6, 33UL*33*33*33*33*33 },
{ 6, 29UL*29*29*29*29*29 }, { 6, 34UL*34*34*34*34*34 },
{ 6, 30UL*30*30*30*30*30 }, { 6, 35UL*35*35*35*35*35 },
{ 6, 31UL*31*31*31*31*31 }, { 6, 36UL*36*36*36*36*36 },
{ 6, 32UL*32*32*32*32*32 }, #endif
{ 6, 33UL*33*33*33*33*33 }, #if (intDsize==64)
{ 6, 34UL*34*34*34*34*34 }, { 63, 2ULL*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2 },
{ 6, 35UL*35*35*35*35*35 }, { 40, 3ULL*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3 },
{ 6, 36UL*36*36*36*36*36 }, { 31, 4ULL*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4 },
#endif { 27, 5ULL*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5 },
#if (intDsize==64) { 24, 6ULL*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6 },
{ 63, 2ULL*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2 }, { 22, 7ULL*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7 },
{ 40, 3ULL*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3*3 }, { 21, 8ULL*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8 },
{ 31, 4ULL*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4*4 }, { 20, 9ULL*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9 },
{ 27, 5ULL*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5*5 }, { 19, 10ULL*10*10*10*10*10*10*10*10*10*10*10*10*10*10*10*10*10*10 },
{ 24, 6ULL*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6*6 }, { 18, 11ULL*11*11*11*11*11*11*11*11*11*11*11*11*11*11*11*11*11 },
{ 22, 7ULL*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7*7 }, { 17, 12ULL*12*12*12*12*12*12*12*12*12*12*12*12*12*12*12*12 },
{ 21, 8ULL*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8*8 }, { 17, 13ULL*13*13*13*13*13*13*13*13*13*13*13*13*13*13*13*13 },
{ 20, 9ULL*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9*9 }, { 16, 14ULL*14*14*14*14*14*14*14*14*14*14*14*14*14*14*14 },
{ 19, 10ULL*10*10*10*10*10*10*10*10*10*10*10*10*10*10*10*10*10*10 }, { 16, 15ULL*15*15*15*15*15*15*15*15*15*15*15*15*15*15*15 },
{ 18, 11ULL*11*11*11*11*11*11*11*11*11*11*11*11*11*11*11*11*11 }, { 15, 16ULL*16*16*16*16*16*16*16*16*16*16*16*16*16*16 },
{ 17, 12ULL*12*12*12*12*12*12*12*12*12*12*12*12*12*12*12*12 }, { 15, 17ULL*17*17*17*17*17*17*17*17*17*17*17*17*17*17 },
{ 17, 13ULL*13*13*13*13*13*13*13*13*13*13*13*13*13*13*13*13 }, { 15, 18ULL*18*18*18*18*18*18*18*18*18*18*18*18*18*18 },
{ 16, 14ULL*14*14*14*14*14*14*14*14*14*14*14*14*14*14*14 }, { 15, 19ULL*19*19*19*19*19*19*19*19*19*19*19*19*19*19 },
{ 16, 15ULL*15*15*15*15*15*15*15*15*15*15*15*15*15*15*15 }, { 14, 20ULL*20*20*20*20*20*20*20*20*20*20*20*20*20 },
{ 15, 16ULL*16*16*16*16*16*16*16*16*16*16*16*16*16*16 }, { 14, 21ULL*21*21*21*21*21*21*21*21*21*21*21*21*21 },
{ 15, 17ULL*17*17*17*17*17*17*17*17*17*17*17*17*17*17 }, { 14, 22ULL*22*22*22*22*22*22*22*22*22*22*22*22*22 },
{ 15, 18ULL*18*18*18*18*18*18*18*18*18*18*18*18*18*18 }, { 14, 23ULL*23*23*23*23*23*23*23*23*23*23*23*23*23 },
{ 15, 19ULL*19*19*19*19*19*19*19*19*19*19*19*19*19*19 }, { 13, 24ULL*24*24*24*24*24*24*24*24*24*24*24*24 },
{ 14, 20ULL*20*20*20*20*20*20*20*20*20*20*20*20*20 }, { 13, 25ULL*25*25*25*25*25*25*25*25*25*25*25*25 },
{ 14, 21ULL*21*21*21*21*21*21*21*21*21*21*21*21*21 }, { 13, 26ULL*26*26*26*26*26*26*26*26*26*26*26*26 },
{ 14, 22ULL*22*22*22*22*22*22*22*22*22*22*22*22*22 }, { 13, 27ULL*27*27*27*27*27*27*27*27*27*27*27*27 },
{ 14, 23ULL*23*23*23*23*23*23*23*23*23*23*23*23*23 }, { 13, 28ULL*28*28*28*28*28*28*28*28*28*28*28*28 },
{ 13, 24ULL*24*24*24*24*24*24*24*24*24*24*24*24 }, { 13, 29ULL*29*29*29*29*29*29*29*29*29*29*29*29 },
{ 13, 25ULL*25*25*25*25*25*25*25*25*25*25*25*25 }, { 13, 30ULL*30*30*30*30*30*30*30*30*30*30*30*30 },
{ 13, 26ULL*26*26*26*26*26*26*26*26*26*26*26*26 }, { 12, 31ULL*31*31*31*31*31*31*31*31*31*31*31 },
{ 13, 27ULL*27*27*27*27*27*27*27*27*27*27*27*27 }, { 12, 32ULL*32*32*32*32*32*32*32*32*32*32*32 },
{ 13, 28ULL*28*28*28*28*28*28*28*28*28*28*28*28 }, { 12, 33ULL*33*33*33*33*33*33*33*33*33*33*33 },
{ 13, 29ULL*29*29*29*29*29*29*29*29*29*29*29*29 }, { 12, 34ULL*34*34*34*34*34*34*34*34*34*34*34 },
{ 13, 30ULL*30*30*30*30*30*30*30*30*30*30*30*30 }, { 12, 35ULL*35*35*35*35*35*35*35*35*35*35*35 },
{ 12, 31ULL*31*31*31*31*31*31*31*31*31*31*31 }, { 12, 36ULL*36*36*36*36*36*36*36*36*36*36*36 },
{ 12, 32ULL*32*32*32*32*32*32*32*32*32*32*32 }, #endif
{ 12, 33ULL*33*33*33*33*33*33*33*33*33*33*33 }, };
{ 12, 34ULL*34*34*34*34*34*34*34*34*34*34*34 }, cached_power_table* ctable [36-2+1] = {
{ 12, 35ULL*35*35*35*35*35*35*35*35*35*35*35 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
{ 12, 36ULL*36*36*36*36*36*36*36*36*36*36*36 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
#endif NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
}; NULL, NULL, NULL, NULL, NULL
};
cached_power_table* ctable [36-2+1] = { const cached_power_table_entry * cached_power (uintD base, uintL i)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, {
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, var cached_power_table* ptr;
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, if (!(ptr = ctable[base-2]))
NULL, NULL, NULL, NULL, NULL { ctable[base-2] = ptr = new cached_power_table (); }
}; var uintL j;
for (j = 0; j <= i; j++) {
const cached_power_table_entry * cached_power (uintD base, uintL i) if (zerop(ptr->element[j].base_pow)) {
{ // Compute b^(k*2^j) and its inverse.
var cached_power_table* ptr; cl_I x =
if (!(ptr = ctable[base-2])) (j==0 ? cl_I(power_table[base-2].b_to_the_k)
{ ctable[base-2] = ptr = new cached_power_table (); } : ptr->element[j-1].base_pow * ptr->element[j-1].base_pow
var uintL j; );
for (j = 0; j <= i; j++) { ptr->element[j].base_pow = x;
if (zerop(ptr->element[j].base_pow)) { #ifdef MUL_REPLACES_DIV
// Compute b^(k*2^j) and its inverse. ptr->element[j].inv_base_pow = floor1(ash(1,2*integer_length(x)),x);
cl_I x = #endif
(j==0 ? cl_I(power_table[base-2].b_to_the_k) }
: ptr->element[j-1].base_pow * ptr->element[j-1].base_pow }
); return &ptr->element[i];
ptr->element[j].base_pow = x; }
#ifdef MUL_REPLACES_DIV AT_DESTRUCTION(cached_power)
ptr->element[j].inv_base_pow = floor1(ash(1,2*integer_length(x)),x); {
#endif for (var uintD base = 2; base <= 36; base++) {
} var cached_power_table* ptr = ctable[base-2];
} if (ptr) {
return &ptr->element[i]; delete ptr;
} ctable[base-2] = NULL;
}
AT_DESTRUCTION(cached_power) }
{ }
for (var uintD base = 2; base <= 36; base++) { } // namespace cln
var cached_power_table* ptr = ctable[base-2];
if (ptr) {
delete ptr;
ctable[base-2] = NULL;
}
}
}
} // namespace cln

94
src/integer/conv/cl_I_cached_power.h

@ -1,47 +1,47 @@
// cached_power(). // cached_power().
// General includes.
// General includes. #include "base/cl_sysdep.h"
#include "base/cl_sysdep.h" // Specification.
#include "integer/cl_I.h"
// Specification. // Implementation.
#include "integer/cl_I.h" namespace cln {
// Table: For each base b (2 <= b <= 36), store k and b^k where k is the largest
// integer such that b^k < 2^intDsize, i.e. k == floor(log(2^intDsize-1,b)).
// Implementation. struct power_table_entry {
uintC k;
namespace cln { uintD b_to_the_k;
};
// Table: For each base b (2 <= b <= 36), store k and b^k where k is the largest extern const power_table_entry power_table [36-2+1];
// integer such that b^k < 2^intDsize, i.e. k == floor(log(2^intDsize-1,b)). // Table: contains for each base b (2 <= b <= 36) either NULL or an array of
struct power_table_entry { // lazily computed b^(k*2^i) and maybe 1/b^(k*2^i).
uintC k; //#define MUL_REPLACES_DIV
uintD b_to_the_k; struct cached_power_table_entry {
}; ALLOCATE_ANYWHERE(cached_power_table_entry)
extern const power_table_entry power_table [36-2+1]; cl_I base_pow; // 0 or b^(k*2^i)
#ifdef MUL_REPLACES_DIV
// Table: contains for each base b (2 <= b <= 36) either NULL or an array of cl_I inv_base_pow; // if base_pow: floor(2^(2*integer_length(base_pow))/base_pow)
// lazily computed b^(k*2^i) and maybe 1/b^(k*2^i). #endif
//#define MUL_REPLACES_DIV };
struct cached_power_table_entry { struct cached_power_table {
ALLOCATE_ANYWHERE(cached_power_table_entry) cached_power_table_entry element[40];
cl_I base_pow; // 0 or b^(k*2^i) // Constructor and destructor - nothing special.
#ifdef MUL_REPLACES_DIV cached_power_table () {}
cl_I inv_base_pow; // if base_pow: floor(2^(2*integer_length(base_pow))/base_pow) ~cached_power_table () {}
#endif // Allocation and deallocation.
}; void* operator new (size_t size) { return malloc_hook(size); }
void operator delete (void* ptr) { free_hook(ptr); }
struct cached_power_table { };
cached_power_table_entry element[40]; extern cached_power_table* ctable [36-2+1];
// Constructor and destructor - nothing special. const cached_power_table_entry * cached_power (uintD base, uintL i);
cached_power_table () {} } // namespace cln
~cached_power_table () {}
// Allocation and deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
void operator delete (void* ptr) { free_hook(ptr); }
};
extern cached_power_table* ctable [36-2+1];
const cached_power_table_entry * cached_power (uintD base, uintL i);
} // namespace cln

2
src/real/input/cl_R_read.cc

@ -165,13 +165,11 @@ not_rational_syntax:
} }
var const char * ptr_after_sign = ptr; var const char * ptr_after_sign = ptr;
var const char * ptr_after_intpart = skip_digits(ptr_after_sign,string_limit,float_base); var const char * ptr_after_intpart = skip_digits(ptr_after_sign,string_limit,float_base);
var bool have_dot = false;
var const char * ptr_before_fracpart = ptr_after_intpart; var const char * ptr_before_fracpart = ptr_after_intpart;
var const char * ptr_after_fracpart = ptr_after_intpart; var const char * ptr_after_fracpart = ptr_after_intpart;
ptr = ptr_after_intpart; ptr = ptr_after_intpart;
if (ptr != string_limit) if (ptr != string_limit)
if (*ptr == '.') { if (*ptr == '.') {
have_dot = true;
ptr_before_fracpart = ptr+1; ptr_before_fracpart = ptr+1;
ptr_after_fracpart = skip_digits(ptr_before_fracpart,string_limit,float_base); ptr_after_fracpart = skip_digits(ptr_before_fracpart,string_limit,float_base);
} }

|||||||
100:0
Loading…
Cancel
Save