This program takes a floating point value as input and converts it into an integer by trimming the decimal point. Please e-mail your suggestion to Jayadev at firstname.lastname@example.org.
The code uses the tag
_asm in VC++. Using the assembly code, the floating point value is converted into an integer value.
Using the Code
The code is very simple and it can be plugged into any other code easily.
ftoi looks like this:
int ftoi(float flt)
mov eax,flt; rcl eax,1; mov ebx,eax; mov edx,4278190080; and eax,edx; shr eax,24;
sub eax,7fh; mov edx,eax; mov eax,ebx; rcl eax,8; mov ebx,eax; mov ecx, 1fh; sub ecx,edx;
shr eax,1; sub ecx,1;
mov i, eax;
- 15th June, 2005: Initial version
Hi.. I have been working on C/C++ for more than 2 years. My areas of interest are Network programming and System Level programming.
I work with C/C++ over Windows and Solaris.