I am baffled
I did not consider the lib to be used on 32 bit systems - and I am more than curious to understand how a change from QWord to PtrUInt did some magic correction. If it is working for you maybe I can easily adapt and provide a pure Pascal version for 32 bit too.
I'm sorry, I should have explained more. On 32 bit, FPC does not allow QWord type for variables used in for loops. Your code will not compile. I had to change QWord to PtrUInt to keep your design intact on 64 bit, and to get it to compile on 32bit. So we still *need* the magic to get it to produce correct results.
Can you do me a favour pls. - can you post what exactly you changed
I also made a small change to RadixStp and RadixMax to make radix 10 suitable for 32 bit, but since QWord is supported on 32 bit - except in for loop vars - this change is not really necessary.
and give an example for an incorrect result with QWord and a correct result with PtrUInt.
The change from QWord to PtrUInt did not correct anything, it just allowed me to compile it on 32 bit. Here is an example:
converting this string
'36893488151714070528' which is equal to $20000000000000000 to number gives
$20000000
100000000 instead. Most likely it is a carry error.
The lib has already developed a lot since the version I put online some time ago.
If I may ask, why did you exclude 32 bit from the pascal version? I understand that maintaining and optimizing the assembly version for 64 bit makes perfect sense, and that pascal version is not going to be geared toward speed.