flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > .. |
Author |
|
pool 12 Mar 2008, 11:41
..
Last edited by pool on 17 Mar 2013, 11:44; edited 1 time in total |
|||
12 Mar 2008, 11:41 |
|
bitRAKE 12 Mar 2008, 12:20
square root is more complicated:
Code: Sqrt: xor ecx,ecx xor eax,eax bsr edx,[esp+4] je .x and edx,-2 ; even bts ecx,edx .0: add eax,ecx sub [esp+4],eax jnc .1 add [esp+4],eax sub eax,ecx jmp .2 .1: add eax,ecx .2: shr eax,1 shr ecx,2 jne .0 .x: retn 4 ; EAX = square root _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
12 Mar 2008, 12:20 |
|
pool 24 Mar 2008, 03:59
..
Last edited by pool on 17 Mar 2013, 11:44; edited 1 time in total |
|||
24 Mar 2008, 03:59 |
|
edfed 24 Mar 2008, 11:37
for that, don't try square root.
the square is enough to know the distance. and in 3D, the principle is to simplify the equation, then, the algo will be little. x2D = k (x/z) y2D = k (y/z) |
|||
24 Mar 2008, 11:37 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.