4 #include "base/cl_sysdep.h"
7 #include "integer/cl_I.h"
12 #include "cln/number.h"
13 #include "base/digitseq/cl_DS.h"
15 #include "base/cl_inline.h"
16 #include "integer/conv/cl_I_from_NDS.cc"
20 CL_INLINE2 const cl_I CL_INLINE2_DECL(DS_to_I) (const uintD* MSDptr, uintC len)
22 // erst normalisieren.
23 // Dabei evtl. MSDptr erhöhen und len erniedrigen:
24 if (!(len==0)) // leere DS ist normalisiert
25 { var uintC count = len-1;
26 if ((sintD)mspref(MSDptr,0) >= 0)
28 { // versuche maximal len-1 führende Nullen-Digits zu streichen:
29 while (!(count==0) && (mspref(MSDptr,0)==0) && ((sintD)mspref(MSDptr,1)>=0))
30 { msshrink(MSDptr); len--; count--; } // Nulldigit streichen
34 // versuche maximal len-1 führende Einsen-Digits zu streichen:
35 { while (!(count==0) && ((sintD)mspref(MSDptr,0)==-1) && ((sintD)mspref(MSDptr,1)<0))
36 { msshrink(MSDptr); len--; count--; } // Einsen-digit streichen
38 // Eventuell ist jetzt noch bei der DS 0 ausnahmsweise len=1,
39 // aber NDS_to_I wird auch damit fertig.
40 return NDS_to_I_inline(MSDptr,len);