Re: [fpc-devel] The "magic div" algorithm

2021-08-20 Thread J. Gareth Moreton via fpc-devel
Something tells me I should purchase that book - I sense it could reveal some interesting insights. Note that while I understand the concept of turning integer division into multiplication (indeed, I implemented the first version into x86 before it was improved with the "calc_divconst_magic_un

Re: [fpc-devel] The "magic div" algorithm

2021-08-20 Thread Marģers . via fpc-devel
   is there a reference to the algorithm that's used to calculate the reciprocal constants used in the integer division optimisations for x86 and AArch64? Hacker’s Delight Second Edition Henry S. Warren, Jr.   ___ fpc-devel maillist - fpc-devel@lists

[fpc-devel] The "magic div" algorithm

2021-08-20 Thread J. Gareth Moreton via fpc-devel
Hi everyone, I know I was told what the algorithm was already, but I can't find it in my email history, so I'm forced to ask again... is there a reference to the algorithm that's used to calculate the reciprocal constants used in the integer division optimisations for x86 and AArch64? It's mo