Assembly language > Assembly discussions

nested __asm

<< < (2/4) > >>

Bitbeisser:

--- Quote from: czerny on April 24, 2012, 05:54:34 PM ---This code is not mine. It is used in lua 5.2. Don't know if others write it the same way or not.

czerny

--- End quote ---
Well, it doesn't matter who's code this is, it just doesn't make any sense...
Can you post a snippet of the original Lua code that shows what exactly they are doing there, it might be possible that you got "lost in translation" (between different C compilers)...

Ralf

czerny:
My question was NOT how I should code that. I know what I had done if it where my code.
My question was: Should Pelles C Mircrosoft compatible at this point (than should nested __asm be allowed) or not.

czerny

czerny:
Here is some code from the lua 5.2 package:


--- Code: ---#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86) /* { */
#define MS_ASMTRICK

--- End code ---


--- Code: ---#if defined(MS_ASMTRICK) /* { */
/* trick with Microsoft assembler for X86 */

#define lua_number2int(i,n)  __asm {__asm fld n   __asm fistp i}
#define lua_number2integer(i,n) lua_number2int(i, n)
#define lua_number2unsigned(i,n)  \
  {__int64 l; __asm {__asm fld n   __asm fistp l} i = (unsigned int)l;}

--- End code ---

czerny

Bitbeisser:

--- Quote from: czerny on April 24, 2012, 10:35:37 PM ---My question was NOT how I should code that. I know what I had done if it where my code.
My question was: Should Pelles C Mircrosoft compatible at this point (than should nested __asm be allowed) or not.

--- End quote ---
JMHO, absolutely not. The Lua folks seem to use some Microsoft specific quirk in that macro, in case of the right defines, so there should be another, probably more appropriate option to handle this in this case...

Ralf

czerny:

--- Quote from: Bitbeisser on April 25, 2012, 12:48:51 AM ---there should be another, probably more appropriate option to handle this in this case...

--- End quote ---

Sure there is one. But once more that is not the point here.

czerny

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version