6
C version of fixed-point Square Root functions
9
long FixedSqrtLP(long n) // Low Precision (8.8)
12
Not used, so unimplemented.
13
If it matters, just copy the first half of the HP version,
14
and multiply the answer by 256.
21
long FixedSqrtHP(long n) // High Precision (8.16)
23
/* This is more or less a direct C transliteration of the asm code.
24
I've replaced right shifting with division, since right shifting
25
signed values is undefined in ANSI C (though it usually works).
26
ROTT does not use this routine heavily. */
27
unsigned long root, mask, val;
32
val = (unsigned long)n;
61
/* use add here to properly emulate the asm - SBF */
62
if ((root+mask) > val)