Changes between Version 1 and Version 2 of Ticket #222, comment 5


Ignore:
Timestamp:
Jun 16, 2011, 9:03:32 AM (13 years ago)
Author:
rudi
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #222, comment 5

    v1 v2  
    66{{{
    77
    8 inline USHORT __fstcw(void)
     8inline unsigned __fstcw(void)
    99{
    10     USHORT out;
    11     asm ( "fstcw %0\n\t" : "=m" (out) : : );
     10    unsigned out;
     11    asm volatile ( "fstcw %0\n\t" : "=m" (out) );
    1212    return out;
    1313}
    1414
    15 inline void __fldcw(USHORT in)
     15inline void __fldcw(unsigned in)
    1616{
    17     asm ( "fldcw %0\n\t" : : "m" (in) : );
     17    asm volatile ( "fldcw %0\n\t" : : "m" (in) );
    1818}
    1919
    20 #define __FPU_CW_SAVE           USHORT fcwState = __fstcw();
     20#define __FPU_CW_SAVE           unsigned fcwState = __fstcw();
    2121#define __FPU_CW_RESTORE        __fldcw(fcwState);
    2222
     
    3838IMHO, this generates the most efficient code. GCC's inline assembler is always fun...
    3939
     40Update: I had to change the code a bit to make it work correctly with GCC335. However, GCC4 produces better output.