using_2032-bit_20floating_20point_20values
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
using_2032-bit_20floating_20point_20values [2018/03/31 13:19] – external edit 127.0.0.1 | using_2032-bit_20floating_20point_20values [2024/01/05 00:21] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 6: | Line 6: | ||
* **FN_ConvertFromSingle** converts a number from a single precision floating point value | * **FN_ConvertFromSingle** converts a number from a single precision floating point value | ||
\\ | \\ | ||
+ | <code bb4w> | ||
DEF FN_ConvertToSingle(A# | DEF FN_ConvertToSingle(A# | ||
LOCAL A%,P% | LOCAL A%,P% | ||
Line 40: | Line 41: | ||
CALL F%,A%,A# | CALL F%,A%,A# | ||
=A# | =A# | ||
+ | </ | ||
\\ **Note:** **FN_ConvertToSingle** is the same routine as **FN_f4** from the supplied //D3DLIB// library, but the assembly language has been commented and the name has been changed for clarity.\\ | \\ **Note:** **FN_ConvertToSingle** is the same routine as **FN_f4** from the supplied //D3DLIB// library, but the assembly language has been commented and the name has been changed for clarity.\\ | ||
---- | ---- | ||
\\ //by Richard Russell, November 2006//\\ \\ The above routines use assembly language code to perform the conversion. An alternative is to use Windows API functions as follows:\\ \\ | \\ //by Richard Russell, November 2006//\\ \\ The above routines use assembly language code to perform the conversion. An alternative is to use Windows API functions as follows:\\ \\ | ||
+ | <code bb4w> | ||
DEF FN_ConvertToSingle(A# | DEF FN_ConvertToSingle(A# | ||
LOCAL A% | LOCAL A% | ||
Line 63: | Line 66: | ||
SYS F%,A%,^A# | SYS F%,A%,^A# | ||
=A# | =A# | ||
+ | </ | ||
If speed is critical, use this conversion function: | If speed is critical, use this conversion function: | ||
+ | <code bb4w> | ||
DEF FN_ConvertToSingle(A# | DEF FN_ConvertToSingle(A# | ||
+ | </ | ||
where the routine **f4** has been assembled previously as follows: | where the routine **f4** has been assembled previously as follows: | ||
+ | <code bb4w> | ||
.f4 | .f4 | ||
mov | mov | ||
Line 94: | Line 101: | ||
pop eax | pop eax | ||
ret | ret | ||
+ | </ | ||
Ensure there is at least a 2048-byte gap between the code and any writable data, to prevent thrashing of the instruction cache. | Ensure there is at least a 2048-byte gap between the code and any writable data, to prevent thrashing of the instruction cache. |
using_2032-bit_20floating_20point_20values.1522502388.txt.gz · Last modified: 2024/01/05 00:16 (external edit)