- // Horner evaluation
- for(int i=0; i<6; i++)
- {
- n *= 256;
- n += addr[i];
- }
-
- // we fit on 15 bytes maximum < 256^6.
-#if defined(_MSC_VER) || defined(__BORLANDC__)
- return Format("%I64u", n);
-#else
- return Format("%llu", n);
-#endif
+ // We need to convert a 6 digit number from base 256 to base 10, using integer
+ // would requires a 48bits one. To avoid this we have to reimplement the div + modulo
+ // with string only
+ bool zero = false;
+ int res;
+ std::string sres;
+ while(!zero)
+ {
+ res = getlastdigit(addr);
+ sres.push_back( '0' + res );
+ zero = (addr[0] == 0) && (addr[1] == 0) && (addr[2] == 0) && (addr[3] == 0) && (addr[4] == 0) && (addr[5] == 0);
+ }
+ // Since we push back the proper number is reversed:
+ std::reverse(sres.begin(),sres.end());
+
+ return sres;