-
January 14th, 2009, 03:42 PM
#1
compiling single assembler code
Hi fellows
I need a little help with this assembler code. I have a library that have this code:
Code:
#ifdef _MSC_VER
static INLINE long lrintf(float f){
int i;
__asm{
fld f
fistp i
};
return i;
}
#endif
Compiling this in 32 bits, working well. Configuring Visual C++ 2008 to compile to 64 bits these problemas are shown:
Code:
error C4235: nonstandard extension used : '__asm' keyword not supported on this architecture
error C2065: 'fld' : undeclared identifier
error C2065: 'fistp' : undeclared identifier
I know this occurs because these instructions are 32bit processors. What I like to know if anyone have a suggestion to translate it to 64 bits. My assembler knowledge is very little.
Fellows thanks to replies
-
January 14th, 2009, 04:22 PM
#2
Re: compiling single assembler code
see this. it appears the recommended way is to use 64bit intrinsics
-
January 14th, 2009, 04:29 PM
#3
Re: compiling single assembler code
-
January 14th, 2009, 04:33 PM
#4
Re: compiling single assembler code
The problem is that inline assembly is not supported by Microsoft Visual C++ on 64-bit machines.
http://msdn.microsoft.com/en-us/library/4ks26t93.aspx
-
January 15th, 2009, 11:25 AM
#5
Re: compiling single assembler code
Fellows, thanks for replies. I've searched the function lrintf and I found out that is a Linux function.
That function round the number to the nearest integer. So I replaced this code by the ceil function.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|