User Tools

Site Tools


optimising_20integer_20division

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

optimising_20integer_20division [2018/03/31 13:19]
127.0.0.1 external edit
optimising_20integer_20division [2018/04/13 10:45] (current)
richardrussell
Line 32: Line 32:
   00B423FA C1 E8 1F                       shr eax,31   00B423FA C1 E8 1F                       shr eax,31
   00B423FD 03 D0                          add edx,eax   00B423FD 03 D0                          add edx,eax
-\\  In the case of **FN_udiv** the dividend can be any register (except eax) or a memory location. For **FN_sdiv** the dividend can be any register (except eax and edx) or a memory location. The divisor can be any 32-bit value except zero.\\ \\  Here is the code of the macros:\\ +\\  In the case of **FN_udiv** the dividend can be any register (except eax) or a memory location. For **FN_sdiv** the dividend can be any register (except eax and edx) or a memory location. The divisor can be any 32-bit value except zero.\\ \\  Here is the code of the macros: 
 + 
 +<code bb4w>  ​
         REM Generate assembler code for fast unsigned division by a constant         REM Generate assembler code for fast unsigned division by a constant
         REM Dividend may be a memory location or a register other than eax         REM Dividend may be a memory location or a register other than eax
Line 131: Line 133:
         DEF FNintu(N) = ((N / 2) << 1) - (INT(N / 2) <> N / 2)         DEF FNintu(N) = ((N / 2) << 1) - (INT(N / 2) <> N / 2)
         DEF FNuint(N%) = (N% >>>​ 1) * 2 + (N% AND 1)         DEF FNuint(N%) = (N% >>>​ 1) * 2 + (N% AND 1)
 +</​code>​
optimising_20integer_20division.txt · Last modified: 2018/04/13 10:45 by richardrussell