Branch: Tag:

1999-10-31

1999-10-31 22:12:54 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Nicer EXTRACT_{FLOAT,DOUBLE}() macros.

Rev: src/opcodes.c:1.59

25:   #include "security.h"   #include "bignum.h"    - RCSID("$Id: opcodes.c,v 1.58 1999/10/31 22:04:11 grubba Exp $"); + RCSID("$Id: opcodes.c,v 1.59 1999/10/31 22:12:54 grubba Exp $");      void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)   {
782: Inside #if defined(FLOAT_IS_IEEE_BIG)
     #ifdef FLOAT_IS_IEEE_BIG   #define EXTRACT_FLOAT(SVAL, INPUT, SHIFT) \ -  { \ +  do { \    float f; \    ((char *)&f)[0] = *((INPUT)); \    ((char *)&f)[1] = *((INPUT)+1); \    ((char *)&f)[2] = *((INPUT)+2); \    ((char *)&f)[3] = *((INPUT)+3); \    (SVAL).u.float_number = f; \ -  } +  } while(0)   #else   #ifdef FLOAT_IS_IEEE_LITTLE   #define EXTRACT_FLOAT(SVAL, INPUT, SHIFT) \ -  { \ +  do { \    float f; \    ((char *)&f)[3] = *((INPUT)); \    ((char *)&f)[2] = *((INPUT)+1); \    ((char *)&f)[1] = *((INPUT)+2); \    ((char *)&f)[0] = *((INPUT)+3); \    (SVAL).u.float_number = f; \ -  } +  } while(0)   #else   #define EXTRACT_FLOAT(SVAL, INPUT, SHIFT) \    /* FIXME! */ \
810: Inside #if defined(DOUBLE_IS_IEEE_BIG)
     #ifdef DOUBLE_IS_IEEE_BIG   #define EXTRACT_DOUBLE(SVAL, INPUT, SHIFT) \ -  { \ +  do { \    double d; \    ((char *)&d)[0] = *((INPUT)); \    ((char *)&d)[1] = *((INPUT)+1); \
821:    ((char *)&d)[6] = *((INPUT)+6); \    ((char *)&d)[7] = *((INPUT)+7); \    (SVAL).u.float_number = (float)d; \ -  } +  } while(0)   #else   #ifdef DOUBLE_IS_IEEE_LITTLE   #define EXTRACT_DOUBLE(SVAL, INPUT, SHIFT) \ -  { \ +  do { \    double d; \    ((char *)&d)[7] = *((INPUT)); \    ((char *)&d)[6] = *((INPUT)+1); \
836:    ((char *)&d)[1] = *((INPUT)+6); \    ((char *)&d)[0] = *((INPUT)+7); \    (SVAL).u.float_number = (float)d; \ -  } +  } while(0)   #else   #define EXTRACT_DOUBLE(SVAL, INPUT, SHIFT) \    /* FIXME! */ \