Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2021-08

Re: The

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

J. Gareth Moreton

Some divisors, like 7, do not have a reciprocal that can be contained within 32 bits. Expanding to 64 bits, however, is a clever approach that I overlooked, since you can permit some loss of precision (the reason why the bit shift is required) due to the limited range. This might be worth exploring.

Gareth aka. Kit

On Tue 24/08/21 20:14 , "Marģers . via" sent:

Show quoted text 42 lines
I came up with even shorter variant of div example  function teDWordDivBy7_v4( divided : dword):dword; assembler; nostackframe; asm      mov ecx,divided      mov rax,2635249153693862181      mul rcx      mov eax,edx end; current version for comparison function teDWordDivBy7_v0( divided : dword):dword; assembler; nostackframe; asm      mov ecx,divided      mov eax,613566757      mul ecx      add edx,ecx      rcr edx,1      shr edx,2      mov eax,edx end;       _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel [1] Links: ------ [1] http://secureweb.fast.net.uk/parse.php?redirect=https://lists.freepascal.or g/cgi-bin/mailman/listinfo/fpc-devel

Reply by email