Possibly is VC++ making a call to ftol
when I use a statement like...
float float_var = 5;
long deci = (long)float_var;
Either way.. I need to find a function ... or get VC++
not to call it.. any ideas? I could use the source too...
Thanks in advance.
david.f...@cas.honeywell.com
Normally this is implemented in a math library.
Gregory Malocha,
Sezam Technologies
David Foringer wrote in message <35e33660...@msnews.microsoft.com>...
So I've created the following... and it seems to work ok.. not all that
happy with it though.. perhaps better assembly programmers can help out.
long _cdecl _ftol(float f)
{
__asm
{
// Remove what the compiler put on the stack for the c function
call.
pop edi
pop esi
pop ebx
// Below is the disassembly generated by the debugger for the
microsoft
// version of _ftol.
// add esp, 0F4h
wait
fnstcw word ptr [ebp-2]
wait
mov ax, word ptr [ebp-2]
or ah, 0Ch
mov word ptr [ebp-4], ax
fldcw word ptr [ebp-4]
fistp qword ptr [ebp-0Ch]
fldcw word ptr [ebp-2]
mov eax, dword ptr [ebp-0Ch]
mov edx, dword ptr [ebp-8]
// End microsoft version.
// Push what the compiler expects back onto the stack for the c
function.
push ebx
push esi
push edi
}
}
David Foringer
Gregory Malocha <_nospam_...@worldnet.att.net_nospam_> wrote in
article <#YgTRER0...@uppssnewspub04.moswest.msn.net>...