Re: [fpc-devel] The

2021-08-24 Thread J. Gareth Moreton via fpc-devel
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

Re: [fpc-devel] Building trunk of today fails on Windows: Error: Invalid DLL C:\WINDOWS\system32\common.dll, invalid header size

2021-08-24 Thread Bart via fpc-devel
On Tue, Aug 24, 2021 at 3:05 PM Sven Barth via fpc-devel wrote: > Wrong. If it would be a 64-bit DLL in System32 of a x86_64 system then there > would be no problem. However a 64-bit DLL in the SysWOW64 directory > (thus the 32-bit System32 directory) *is* a problem. Same for a 32-bit DLL in >

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

2021-08-24 Thread Marģers . via fpc-devel
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 :

Re: [fpc-devel] Building a debug version of FPC-main on Windows

2021-08-24 Thread Werner Pamler via fpc-devel
Am 23.08.2021 um 18:14 schrieb Marco van de Voort via fpc-devel: [...] I notice is that you point lazarus to the ppu's in the FPC source tree [...] Sorry, I don't understand: There is no Lazarus involved in my build script. If there is, show me the line and how you would modify it.

Re: [fpc-devel] Building trunk of today fails on Windows: Error: Invalid DLL C:\WINDOWS\system32\common.dll, invalid header size

2021-08-24 Thread Sven Barth via fpc-devel
Bart via fpc-devel schrieb am Di., 24. Aug. 2021, 06:31: > On Mon, Aug 23, 2021 at 3:35 PM Yuriy Sydorov via fpc-devel > wrote: > > > Just move common.dll from SysWOW64 to system32. The file is placed > wrongly > > by some installer. > > If I understand Tomas correctly then that would not make

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

2021-08-24 Thread Marģers . via fpc-devel
I was over exited of making working example for byte div case. For word case it can be done. In case of dword div it's not so nice. It's theoretically possible to shave 1 cpu clock cycle. And i have no working example jet. Sorry, for spreading false hope. example for byte case: function

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

2021-08-24 Thread Marģers . via fpc-devel
if you have not bout book you can always try search in internet. I did some research in magic div constants. As already known, there are good case where you can replace division by mov magic mul shr and bad case mov magic mul add rcr shr Bad cases are approximately  1/3 of all cases. For