CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Posts
    173

    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

  2. #2
    Join Date
    Feb 2002
    Posts
    3,788

    Re: compiling single assembler code

    see this. it appears the recommended way is to use 64bit intrinsics

  3. #3
    Join Date
    Feb 2002
    Posts
    3,788

  4. #4
    Join Date
    Jan 2009
    Posts
    28

    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

  5. #5
    Join Date
    Oct 2005
    Posts
    173

    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
  •  





Click Here to Expand Forum to Full Width

Featured