Annotation of tme/ic/ieee754/ieee754-auto.h, revision 1.1

1.1     ! root        1: /* automatically generated by ieee754-misc-auto.sh, do not edit! */
        !             2: #include <tme/common.h>
        !             3: _TME_RCSID("$Id: ieee754-misc-auto.sh,v 1.2 2005/05/11 00:13:33 fredette Exp $");
        !             4: 
        !             5: 
        !             6: /* decide which builtin C floating-point type is the best match for
        !             7:    the IEEE 754 single precision format.  if a builtin type matches
        !             8:    this format exactly, use that type, otherwise we assume that the
        !             9:    smallest builtin type that is at least 4 bytes wide is the best
        !            10:    match.  if no builtin type is at least that wide, we use long
        !            11:    double, or double if long double is not available: */
        !            12: #if ((TME_FLOAT_FORMATS_BUILTIN & TME_FLOAT_FORMAT_IEEE754_SINGLE) != 0)
        !            13: #define TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN TME_FLOAT_FORMAT_IEEE754_SINGLE
        !            14: #elif (_TME_SIZEOF_FLOAT >= 4)
        !            15: #define TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN TME_FLOAT_FORMAT_FLOAT
        !            16: #elif (_TME_SIZEOF_DOUBLE >= 4 || !defined(_TME_HAVE_LONG_DOUBLE))
        !            17: #define TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN TME_FLOAT_FORMAT_DOUBLE
        !            18: #else
        !            19: #define TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN TME_FLOAT_FORMAT_LONG_DOUBLE
        !            20: #endif
        !            21: 
        !            22: /* typedef the builtin C floating-point type that is the best match
        !            23:    for the IEEE 754 single precision format: */
        !            24: #if (TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN == TME_FLOAT_FORMAT_FLOAT)
        !            25: typedef float tme_ieee754_single_builtin_t;
        !            26: #define tme_float_value_ieee754_single_builtin tme_float_value_float
        !            27: #elif (TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN == TME_FLOAT_FORMAT_DOUBLE)
        !            28: typedef double tme_ieee754_single_builtin_t;
        !            29: #define tme_float_value_ieee754_single_builtin tme_float_value_double
        !            30: #elif (TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN == TME_FLOAT_FORMAT_LONG_DOUBLE)
        !            31: typedef long double tme_ieee754_single_builtin_t;
        !            32: #define tme_float_value_ieee754_single_builtin tme_float_value_long_double
        !            33: #endif
        !            34: 
        !            35: /* this asserts that the float is either in IEEE 754 single
        !            36:    precision format, or in the best-match builtin type format.  it
        !            37:    evaluates to nonzero if the float is in IEEE 754 single
        !            38:    precision format: */
        !            39: #define tme_ieee754_single_is_format(x) \
        !            40:   (tme_float_assert_formats(x, \
        !            41:                             TME_FLOAT_FORMAT_IEEE754_SINGLE | TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN) \
        !            42:    && tme_float_is_format(x, \
        !            43:                           TME_FLOAT_FORMAT_IEEE754_SINGLE | TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN, \
        !            44:                          TME_FLOAT_FORMAT_IEEE754_SINGLE))
        !            45: 
        !            46: /* this asserts that the float is either in IEEE 754 single
        !            47:    precision format, or in the best-match builtin type format.  it
        !            48:    evaluates to nonzero if the float is in the best-match builtin 
        !            49:    type format: */
        !            50: #define tme_ieee754_single_is_format_builtin(x) \
        !            51:   (tme_float_assert_formats(x, \
        !            52:                             TME_FLOAT_FORMAT_IEEE754_SINGLE | TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN) \
        !            53:    && tme_float_is_format(x, \
        !            54:                           TME_FLOAT_FORMAT_IEEE754_SINGLE | TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN, \
        !            55:                          TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN))
        !            56: 
        !            57: /* this asserts that the float is either in IEEE 754 single
        !            58:    precision format, or in the best-match builtin type format.  it
        !            59:    evaluates to nonzero if the float is a NaN: */
        !            60: #define tme_ieee754_single_is_nan(x) \
        !            61:   (tme_float_assert_formats(x, \
        !            62:                             TME_FLOAT_FORMAT_IEEE754_SINGLE | TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN) \
        !            63:    && tme_float_is_nan(x, \
        !            64:                        TME_FLOAT_FORMAT_IEEE754_SINGLE | TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN))
        !            65: 
        !            66: /* this asserts that the float is either in IEEE 754 single
        !            67:    precision format, or in the best-match builtin type format.  it
        !            68:    evaluates to nonzero if the float is an infinity: */
        !            69: #define tme_ieee754_single_is_inf(x) \
        !            70:   (tme_float_assert_formats(x, \
        !            71:                             TME_FLOAT_FORMAT_IEEE754_SINGLE | TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN) \
        !            72:    && tme_float_is_inf(x, \
        !            73:                        TME_FLOAT_FORMAT_IEEE754_SINGLE | TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN))
        !            74: 
        !            75: /* this asserts that the float is either in IEEE 754 single
        !            76:    precision format, or in the best-match builtin type format.  it
        !            77:    evaluates to nonzero if the float is a zero: */
        !            78: #define tme_ieee754_single_is_zero(x) \
        !            79:   (tme_float_assert_formats(x, \
        !            80:                             TME_FLOAT_FORMAT_IEEE754_SINGLE | TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN) \
        !            81:    && tme_float_is_zero(x, \
        !            82:                         TME_FLOAT_FORMAT_IEEE754_SINGLE | TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN))
        !            83: 
        !            84: /* tme_ieee754_single_value_get(x, buffer) returns a pointer to
        !            85:    the value of x in IEEE 754 single precision format (i.e., it 
        !            86:    returns a pointer to tme_uint32_t).  if x isn't already in this 
        !            87:    format, it is converted into that format in the given buffer: */
        !            88: #define tme_ieee754_single_value_get(x, buffer) \
        !            89:   (tme_ieee754_single_is_format(x) \
        !            90:    ? &(x)->tme_float_value_ieee754_single \
        !            91:    : tme_ieee754_single_value_from_builtin((x)->tme_float_value_ieee754_single_builtin, buffer))
        !            92: 
        !            93: /* tme_ieee754_single_value_set(x, y) sets the value of x to
        !            94:    y, in IEEE 754 single precision format (i.e., y is a tme_uint32_t).  
        !            95:    (the internal function _tme_ieee754_single_value_set(x, t, y) 
        !            96:    takes the type of y, which must be compatible with tme_uint32_t): */
        !            97: #define tme_ieee754_single_value_set(x, y) \
        !            98:   do { \
        !            99:     (x)->tme_float_value_ieee754_single = (y); \
        !           100:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_SINGLE; \
        !           101:   } while (/* CONSTCOND */ 0)
        !           102: #define _tme_ieee754_single_value_set(x, t, y) \
        !           103:   do { \
        !           104:     *((t *) &(x)->tme_float_value_ieee754_single) = (y); \
        !           105:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_SINGLE; \
        !           106:   } while (/* CONSTCOND */ 0)
        !           107: 
        !           108: /* tme_ieee754_single_value_set_constant(x, y) sets the value of 
        !           109:    x to the constant y (i.e., y is a const tme_uint32_t *): */
        !           110: #define tme_ieee754_single_value_set_constant(x, y) \
        !           111:   do { \
        !           112:     (x)->tme_float_value_ieee754_single = *(y); \
        !           113:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_SINGLE; \
        !           114:   } while (/* CONSTCOND */ 0)
        !           115: 
        !           116: /* tme_ieee754_single_value_builtin_get(x) returns the value of 
        !           117:    x as the builtin C type that is the best match for the IEEE 754
        !           118:    single precision format: */
        !           119: #define tme_ieee754_single_value_builtin_get(x) \
        !           120:   (tme_ieee754_single_is_format_builtin(x) \
        !           121:    ? (x)->tme_float_value_ieee754_single_builtin \
        !           122:    : tme_ieee754_single_value_to_builtin(&(x)->tme_float_value_ieee754_single))
        !           123: 
        !           124: /* tme_ieee754_single_value_builtin_set(x, format, y) sets the value of
        !           125:    x to y, whose type is a builtin C type with format format.  if the value of
        !           126:    y is a NaN or an infinity, y is stored in x in IEEE 754 single
        !           127:    precision format, otherwise y is stored in x as the builtin C type 
        !           128:    that is the best match for the IEEE 754 single precision format: */
        !           129: #define tme_ieee754_single_value_builtin_set(x, format, y) \
        !           130:   do { \
        !           131:     /* set the value: */ \
        !           132:     tme_float_value_builtin_set(x, format, y); \
        !           133:     \
        !           134:     /* if the result is a NaN: */ \
        !           135:     if (tme_float_is_nan(x, format)) { \
        !           136:       \
        !           137:       /* use the proper default IEEE 754 single precision NaN: */ \
        !           138:       (x)->tme_float_value_ieee754_single = ieee754_ctl->tme_ieee754_ctl_default_nan_single; \
        !           139:       (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_SINGLE; \
        !           140:     } \
        !           141:     \
        !           142:     /* otherwise, if the result isn't already in IEEE 754 single precision format: */ \
        !           143:     else if ((format) != TME_FLOAT_FORMAT_IEEE754_SINGLE) { \
        !           144:       \
        !           145:       /* if the result is infinite: */ \
        !           146:       if (tme_float_is_inf(x, format)) { \
        !           147:         \
        !           148:        /* use the IEEE 754 single precision infinity: */ \
        !           149:         (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_SINGLE; \
        !           150:        (x)->tme_float_value_ieee754_single = ((tme_uint32_t) 0x7f800000) | (tme_float_is_negative(x, (format)) ? (((tme_uint32_t) 0x7f800000) + _TME_FIELD_MASK_FACTOR(((tme_uint32_t) 0x7f800000))) : 0); \
        !           151:       } \
        !           152:       \
        !           153:       /* otherwise, if the result isn't already the builtin C type that \
        !           154:          is the best match for the IEEE 754 single precision format: */ \
        !           155:       else if ((format) != TME_FLOAT_FORMAT_IEEE754_SINGLE_BUILTIN) { \
        !           156:         \
        !           157:        /* convert the result: */ \
        !           158:        if ((format) == TME_FLOAT_FORMAT_FLOAT) { \
        !           159:          (x)->tme_float_value_ieee754_single_builtin = (x)->tme_float_value_float; \
        !           160:        } \
        !           161:         TME_FLOAT_IF_LONG_DOUBLE(else if ((format) == TME_FLOAT_FORMAT_LONG_DOUBLE) { \
        !           162:          (x)->tme_float_value_ieee754_single_builtin = (x)->tme_float_value_long_double; \
        !           163:        }) \
        !           164:        else { \
        !           165:          assert((format) == TME_FLOAT_FORMAT_DOUBLE); \
        !           166:          (x)->tme_float_value_ieee754_single_builtin = (x)->tme_float_value_double; \
        !           167:        } \
        !           168:       } \
        !           169:     } \
        !           170:   } while (/* CONSTCOND */ 0)
        !           171: 
        !           172: /* this converts a value from IEEE 754 single precision format
        !           173:    into the builtin C type that is the best match for that format: */
        !           174: tme_ieee754_single_builtin_t tme_ieee754_single_value_to_builtin _TME_P((const tme_uint32_t *));
        !           175: 
        !           176: /* this converts a value from the builtin C type that is the best
        !           177:    match for the IEEE 754 single precision format, into that
        !           178:    format: */
        !           179: const tme_uint32_t *tme_ieee754_single_value_from_builtin _TME_P((tme_ieee754_single_builtin_t, tme_uint32_t *));
        !           180: 
        !           181: /* this does a NaN check for an IEEE 754 single precision monadic function: */
        !           182: int tme_ieee754_single_check_nan_monadic _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, struct tme_float *));
        !           183: 
        !           184: /* this does a NaN check for an IEEE 754 single precision dyadic function: */
        !           185: int tme_ieee754_single_check_nan_dyadic _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, const struct tme_float *, struct tme_float *));
        !           186: 
        !           187: /* this converts a tme_uint32_t to a single: */
        !           188: void tme_ieee754_single_from_int32 _TME_P((tme_uint32_t, struct tme_float *));
        !           189: 
        !           190: #if defined(TME_HAVE_INT64_T)
        !           191: 
        !           192: /* this converts a tme_uint64_t to a single: */
        !           193: void tme_ieee754_single_from_int64 _TME_P((tme_uint64_t, struct tme_float *));
        !           194: 
        !           195: #endif /* defined(TME_HAVE_INT64_T) */
        !           196: 
        !           197: /* this converts an in-range IEEE 754 single precision value into its
        !           198:    radix 10 mantissa and exponent.  the mantissa is either zero, or 
        !           199:    in the range [1,10): */
        !           200: void tme_ieee754_single_radix10_mantissa_exponent _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, struct tme_float *, struct tme_float *));
        !           201: 
        !           202: /* this scales an IEEE 754 single precision value by adding n to its 
        !           203:    radix 10 exponent: */
        !           204: void tme_ieee754_single_radix10_scale _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, const struct tme_float *, struct tme_float *));
        !           205: 
        !           206: 
        !           207: /* decide which builtin C floating-point type is the best match for
        !           208:    the IEEE 754 double precision format.  if a builtin type matches
        !           209:    this format exactly, use that type, otherwise we assume that the
        !           210:    smallest builtin type that is at least 8 bytes wide is the best
        !           211:    match.  if no builtin type is at least that wide, we use long
        !           212:    double, or double if long double is not available: */
        !           213: #if ((TME_FLOAT_FORMATS_BUILTIN & TME_FLOAT_FORMAT_IEEE754_DOUBLE) != 0)
        !           214: #define TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN TME_FLOAT_FORMAT_IEEE754_DOUBLE
        !           215: #elif (_TME_SIZEOF_FLOAT >= 8)
        !           216: #define TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN TME_FLOAT_FORMAT_FLOAT
        !           217: #elif (_TME_SIZEOF_DOUBLE >= 8 || !defined(_TME_HAVE_LONG_DOUBLE))
        !           218: #define TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN TME_FLOAT_FORMAT_DOUBLE
        !           219: #else
        !           220: #define TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN TME_FLOAT_FORMAT_LONG_DOUBLE
        !           221: #endif
        !           222: 
        !           223: /* typedef the builtin C floating-point type that is the best match
        !           224:    for the IEEE 754 double precision format: */
        !           225: #if (TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN == TME_FLOAT_FORMAT_FLOAT)
        !           226: typedef float tme_ieee754_double_builtin_t;
        !           227: #define tme_float_value_ieee754_double_builtin tme_float_value_float
        !           228: #elif (TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN == TME_FLOAT_FORMAT_DOUBLE)
        !           229: typedef double tme_ieee754_double_builtin_t;
        !           230: #define tme_float_value_ieee754_double_builtin tme_float_value_double
        !           231: #elif (TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN == TME_FLOAT_FORMAT_LONG_DOUBLE)
        !           232: typedef long double tme_ieee754_double_builtin_t;
        !           233: #define tme_float_value_ieee754_double_builtin tme_float_value_long_double
        !           234: #endif
        !           235: 
        !           236: /* this asserts that the float is either in IEEE 754 double
        !           237:    precision format, or in the best-match builtin type format.  it
        !           238:    evaluates to nonzero if the float is in IEEE 754 double
        !           239:    precision format: */
        !           240: #define tme_ieee754_double_is_format(x) \
        !           241:   (tme_float_assert_formats(x, \
        !           242:                             TME_FLOAT_FORMAT_IEEE754_DOUBLE | TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN) \
        !           243:    && tme_float_is_format(x, \
        !           244:                           TME_FLOAT_FORMAT_IEEE754_DOUBLE | TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN, \
        !           245:                          TME_FLOAT_FORMAT_IEEE754_DOUBLE))
        !           246: 
        !           247: /* this asserts that the float is either in IEEE 754 double
        !           248:    precision format, or in the best-match builtin type format.  it
        !           249:    evaluates to nonzero if the float is in the best-match builtin 
        !           250:    type format: */
        !           251: #define tme_ieee754_double_is_format_builtin(x) \
        !           252:   (tme_float_assert_formats(x, \
        !           253:                             TME_FLOAT_FORMAT_IEEE754_DOUBLE | TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN) \
        !           254:    && tme_float_is_format(x, \
        !           255:                           TME_FLOAT_FORMAT_IEEE754_DOUBLE | TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN, \
        !           256:                          TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN))
        !           257: 
        !           258: /* this asserts that the float is either in IEEE 754 double
        !           259:    precision format, or in the best-match builtin type format.  it
        !           260:    evaluates to nonzero if the float is a NaN: */
        !           261: #define tme_ieee754_double_is_nan(x) \
        !           262:   (tme_float_assert_formats(x, \
        !           263:                             TME_FLOAT_FORMAT_IEEE754_DOUBLE | TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN) \
        !           264:    && tme_float_is_nan(x, \
        !           265:                        TME_FLOAT_FORMAT_IEEE754_DOUBLE | TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN))
        !           266: 
        !           267: /* this asserts that the float is either in IEEE 754 double
        !           268:    precision format, or in the best-match builtin type format.  it
        !           269:    evaluates to nonzero if the float is an infinity: */
        !           270: #define tme_ieee754_double_is_inf(x) \
        !           271:   (tme_float_assert_formats(x, \
        !           272:                             TME_FLOAT_FORMAT_IEEE754_DOUBLE | TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN) \
        !           273:    && tme_float_is_inf(x, \
        !           274:                        TME_FLOAT_FORMAT_IEEE754_DOUBLE | TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN))
        !           275: 
        !           276: /* this asserts that the float is either in IEEE 754 double
        !           277:    precision format, or in the best-match builtin type format.  it
        !           278:    evaluates to nonzero if the float is a zero: */
        !           279: #define tme_ieee754_double_is_zero(x) \
        !           280:   (tme_float_assert_formats(x, \
        !           281:                             TME_FLOAT_FORMAT_IEEE754_DOUBLE | TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN) \
        !           282:    && tme_float_is_zero(x, \
        !           283:                         TME_FLOAT_FORMAT_IEEE754_DOUBLE | TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN))
        !           284: 
        !           285: /* tme_ieee754_double_value_get(x, buffer) returns a pointer to
        !           286:    the value of x in IEEE 754 double precision format (i.e., it 
        !           287:    returns a pointer to union tme_value64).  if x isn't already in this 
        !           288:    format, it is converted into that format in the given buffer: */
        !           289: #define tme_ieee754_double_value_get(x, buffer) \
        !           290:   (tme_ieee754_double_is_format(x) \
        !           291:    ? &(x)->tme_float_value_ieee754_double \
        !           292:    : tme_ieee754_double_value_from_builtin((x)->tme_float_value_ieee754_double_builtin, buffer))
        !           293: 
        !           294: /* tme_ieee754_double_value_set(x, y) sets the value of x to
        !           295:    y, in IEEE 754 double precision format (i.e., y is a union tme_value64).  
        !           296:    (the internal function _tme_ieee754_double_value_set(x, t, y) 
        !           297:    takes the type of y, which must be compatible with union tme_value64): */
        !           298: #define tme_ieee754_double_value_set(x, y) \
        !           299:   do { \
        !           300:     (x)->tme_float_value_ieee754_double = (y); \
        !           301:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_DOUBLE; \
        !           302:   } while (/* CONSTCOND */ 0)
        !           303: #define _tme_ieee754_double_value_set(x, t, y) \
        !           304:   do { \
        !           305:     *((t *) &(x)->tme_float_value_ieee754_double) = (y); \
        !           306:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_DOUBLE; \
        !           307:   } while (/* CONSTCOND */ 0)
        !           308: 
        !           309: /* tme_ieee754_double_value_set_constant(x, y) sets the value of 
        !           310:    x to the constant y (i.e., y is a const struct tme_ieee754_double_constant *): */
        !           311: #define tme_ieee754_double_value_set_constant(x, y) \
        !           312:   do { \
        !           313:     (x)->tme_float_value_ieee754_double.tme_value64_uint32_hi = (y)->tme_ieee754_double_constant_hi; \
        !           314:     (x)->tme_float_value_ieee754_double.tme_value64_uint32_lo = (y)->tme_ieee754_double_constant_lo; \
        !           315:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_DOUBLE; \
        !           316:   } while (/* CONSTCOND */ 0)
        !           317: 
        !           318: /* tme_ieee754_double_value_builtin_get(x) returns the value of 
        !           319:    x as the builtin C type that is the best match for the IEEE 754
        !           320:    double precision format: */
        !           321: #define tme_ieee754_double_value_builtin_get(x) \
        !           322:   (tme_ieee754_double_is_format_builtin(x) \
        !           323:    ? (x)->tme_float_value_ieee754_double_builtin \
        !           324:    : tme_ieee754_double_value_to_builtin(&(x)->tme_float_value_ieee754_double))
        !           325: 
        !           326: /* tme_ieee754_double_value_builtin_set(x, format, y) sets the value of
        !           327:    x to y, whose type is a builtin C type with format format.  if the value of
        !           328:    y is a NaN or an infinity, y is stored in x in IEEE 754 double
        !           329:    precision format, otherwise y is stored in x as the builtin C type 
        !           330:    that is the best match for the IEEE 754 double precision format: */
        !           331: #define tme_ieee754_double_value_builtin_set(x, format, y) \
        !           332:   do { \
        !           333:     /* set the value: */ \
        !           334:     tme_float_value_builtin_set(x, format, y); \
        !           335:     \
        !           336:     /* if the result is a NaN: */ \
        !           337:     if (tme_float_is_nan(x, format)) { \
        !           338:       \
        !           339:       /* use the proper default IEEE 754 double precision NaN: */ \
        !           340:       (x)->tme_float_value_ieee754_double = ieee754_ctl->tme_ieee754_ctl_default_nan_double; \
        !           341:       (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_DOUBLE; \
        !           342:     } \
        !           343:     \
        !           344:     /* otherwise, if the result isn't already in IEEE 754 double precision format: */ \
        !           345:     else if ((format) != TME_FLOAT_FORMAT_IEEE754_DOUBLE) { \
        !           346:       \
        !           347:       /* if the result is infinite: */ \
        !           348:       if (tme_float_is_inf(x, format)) { \
        !           349:         \
        !           350:        /* use the IEEE 754 double precision infinity: */ \
        !           351:         (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_DOUBLE; \
        !           352:        (x)->tme_float_value_ieee754_double.tme_value64_uint32_hi = ((tme_uint32_t) 0x7ff00000) | (tme_float_is_negative(x, (format)) ? (((tme_uint32_t) 0x7ff00000) + _TME_FIELD_MASK_FACTOR(((tme_uint32_t) 0x7ff00000))) : 0); \
        !           353:        (x)->tme_float_value_ieee754_double.tme_value64_uint32_lo = 0; \
        !           354:       } \
        !           355:       \
        !           356:       /* otherwise, if the result isn't already the builtin C type that \
        !           357:          is the best match for the IEEE 754 double precision format: */ \
        !           358:       else if ((format) != TME_FLOAT_FORMAT_IEEE754_DOUBLE_BUILTIN) { \
        !           359:         \
        !           360:        /* convert the result: */ \
        !           361:        if ((format) == TME_FLOAT_FORMAT_FLOAT) { \
        !           362:          (x)->tme_float_value_ieee754_double_builtin = (x)->tme_float_value_float; \
        !           363:        } \
        !           364:         TME_FLOAT_IF_LONG_DOUBLE(else if ((format) == TME_FLOAT_FORMAT_LONG_DOUBLE) { \
        !           365:          (x)->tme_float_value_ieee754_double_builtin = (x)->tme_float_value_long_double; \
        !           366:        }) \
        !           367:        else { \
        !           368:          assert((format) == TME_FLOAT_FORMAT_DOUBLE); \
        !           369:          (x)->tme_float_value_ieee754_double_builtin = (x)->tme_float_value_double; \
        !           370:        } \
        !           371:       } \
        !           372:     } \
        !           373:   } while (/* CONSTCOND */ 0)
        !           374: 
        !           375: /* this converts a value from IEEE 754 double precision format
        !           376:    into the builtin C type that is the best match for that format: */
        !           377: tme_ieee754_double_builtin_t tme_ieee754_double_value_to_builtin _TME_P((const union tme_value64 *));
        !           378: 
        !           379: /* this converts a value from the builtin C type that is the best
        !           380:    match for the IEEE 754 double precision format, into that
        !           381:    format: */
        !           382: const union tme_value64 *tme_ieee754_double_value_from_builtin _TME_P((tme_ieee754_double_builtin_t, union tme_value64 *));
        !           383: 
        !           384: /* this does a NaN check for an IEEE 754 double precision monadic function: */
        !           385: int tme_ieee754_double_check_nan_monadic _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, struct tme_float *));
        !           386: 
        !           387: /* this does a NaN check for an IEEE 754 double precision dyadic function: */
        !           388: int tme_ieee754_double_check_nan_dyadic _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, const struct tme_float *, struct tme_float *));
        !           389: 
        !           390: /* this converts a tme_uint32_t to a double: */
        !           391: void tme_ieee754_double_from_int32 _TME_P((tme_uint32_t, struct tme_float *));
        !           392: 
        !           393: #if defined(TME_HAVE_INT64_T)
        !           394: 
        !           395: /* this converts a tme_uint64_t to a double: */
        !           396: void tme_ieee754_double_from_int64 _TME_P((tme_uint64_t, struct tme_float *));
        !           397: 
        !           398: #endif /* defined(TME_HAVE_INT64_T) */
        !           399: 
        !           400: /* this converts an in-range IEEE 754 double precision value into its
        !           401:    radix 10 mantissa and exponent.  the mantissa is either zero, or 
        !           402:    in the range [1,10): */
        !           403: void tme_ieee754_double_radix10_mantissa_exponent _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, struct tme_float *, struct tme_float *));
        !           404: 
        !           405: /* this scales an IEEE 754 double precision value by adding n to its 
        !           406:    radix 10 exponent: */
        !           407: void tme_ieee754_double_radix10_scale _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, const struct tme_float *, struct tme_float *));
        !           408: 
        !           409: 
        !           410: /* decide which builtin C floating-point type is the best match for
        !           411:    the IEEE 754 extended80 precision format.  if a builtin type matches
        !           412:    this format exactly, use that type, otherwise we assume that the
        !           413:    smallest builtin type that is at least 12 bytes wide is the best
        !           414:    match.  if no builtin type is at least that wide, we use long
        !           415:    double, or double if long double is not available: */
        !           416: #if ((TME_FLOAT_FORMATS_BUILTIN & TME_FLOAT_FORMAT_IEEE754_EXTENDED80) != 0)
        !           417: #define TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN TME_FLOAT_FORMAT_IEEE754_EXTENDED80
        !           418: #elif (_TME_SIZEOF_FLOAT >= 12)
        !           419: #define TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN TME_FLOAT_FORMAT_FLOAT
        !           420: #elif (_TME_SIZEOF_DOUBLE >= 12 || !defined(_TME_HAVE_LONG_DOUBLE))
        !           421: #define TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN TME_FLOAT_FORMAT_DOUBLE
        !           422: #else
        !           423: #define TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN TME_FLOAT_FORMAT_LONG_DOUBLE
        !           424: #endif
        !           425: 
        !           426: /* typedef the builtin C floating-point type that is the best match
        !           427:    for the IEEE 754 extended80 precision format: */
        !           428: #if (TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN == TME_FLOAT_FORMAT_FLOAT)
        !           429: typedef float tme_ieee754_extended80_builtin_t;
        !           430: #define tme_float_value_ieee754_extended80_builtin tme_float_value_float
        !           431: #elif (TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN == TME_FLOAT_FORMAT_DOUBLE)
        !           432: typedef double tme_ieee754_extended80_builtin_t;
        !           433: #define tme_float_value_ieee754_extended80_builtin tme_float_value_double
        !           434: #elif (TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN == TME_FLOAT_FORMAT_LONG_DOUBLE)
        !           435: typedef long double tme_ieee754_extended80_builtin_t;
        !           436: #define tme_float_value_ieee754_extended80_builtin tme_float_value_long_double
        !           437: #endif
        !           438: 
        !           439: /* this asserts that the float is either in IEEE 754 extended80
        !           440:    precision format, or in the best-match builtin type format.  it
        !           441:    evaluates to nonzero if the float is in IEEE 754 extended80
        !           442:    precision format: */
        !           443: #define tme_ieee754_extended80_is_format(x) \
        !           444:   (tme_float_assert_formats(x, \
        !           445:                             TME_FLOAT_FORMAT_IEEE754_EXTENDED80 | TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN) \
        !           446:    && tme_float_is_format(x, \
        !           447:                           TME_FLOAT_FORMAT_IEEE754_EXTENDED80 | TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN, \
        !           448:                          TME_FLOAT_FORMAT_IEEE754_EXTENDED80))
        !           449: 
        !           450: /* this asserts that the float is either in IEEE 754 extended80
        !           451:    precision format, or in the best-match builtin type format.  it
        !           452:    evaluates to nonzero if the float is in the best-match builtin 
        !           453:    type format: */
        !           454: #define tme_ieee754_extended80_is_format_builtin(x) \
        !           455:   (tme_float_assert_formats(x, \
        !           456:                             TME_FLOAT_FORMAT_IEEE754_EXTENDED80 | TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN) \
        !           457:    && tme_float_is_format(x, \
        !           458:                           TME_FLOAT_FORMAT_IEEE754_EXTENDED80 | TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN, \
        !           459:                          TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN))
        !           460: 
        !           461: /* this asserts that the float is either in IEEE 754 extended80
        !           462:    precision format, or in the best-match builtin type format.  it
        !           463:    evaluates to nonzero if the float is a NaN: */
        !           464: #define tme_ieee754_extended80_is_nan(x) \
        !           465:   (tme_float_assert_formats(x, \
        !           466:                             TME_FLOAT_FORMAT_IEEE754_EXTENDED80 | TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN) \
        !           467:    && tme_float_is_nan(x, \
        !           468:                        TME_FLOAT_FORMAT_IEEE754_EXTENDED80 | TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN))
        !           469: 
        !           470: /* this asserts that the float is either in IEEE 754 extended80
        !           471:    precision format, or in the best-match builtin type format.  it
        !           472:    evaluates to nonzero if the float is an infinity: */
        !           473: #define tme_ieee754_extended80_is_inf(x) \
        !           474:   (tme_float_assert_formats(x, \
        !           475:                             TME_FLOAT_FORMAT_IEEE754_EXTENDED80 | TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN) \
        !           476:    && tme_float_is_inf(x, \
        !           477:                        TME_FLOAT_FORMAT_IEEE754_EXTENDED80 | TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN))
        !           478: 
        !           479: /* this asserts that the float is either in IEEE 754 extended80
        !           480:    precision format, or in the best-match builtin type format.  it
        !           481:    evaluates to nonzero if the float is a zero: */
        !           482: #define tme_ieee754_extended80_is_zero(x) \
        !           483:   (tme_float_assert_formats(x, \
        !           484:                             TME_FLOAT_FORMAT_IEEE754_EXTENDED80 | TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN) \
        !           485:    && tme_float_is_zero(x, \
        !           486:                         TME_FLOAT_FORMAT_IEEE754_EXTENDED80 | TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN))
        !           487: 
        !           488: /* tme_ieee754_extended80_value_get(x, buffer) returns a pointer to
        !           489:    the value of x in IEEE 754 extended80 precision format (i.e., it 
        !           490:    returns a pointer to struct tme_float_ieee754_extended80).  if x isn't already in this 
        !           491:    format, it is converted into that format in the given buffer: */
        !           492: #define tme_ieee754_extended80_value_get(x, buffer) \
        !           493:   (tme_ieee754_extended80_is_format(x) \
        !           494:    ? &(x)->tme_float_value_ieee754_extended80 \
        !           495:    : tme_ieee754_extended80_value_from_builtin((x)->tme_float_value_ieee754_extended80_builtin, buffer))
        !           496: 
        !           497: /* tme_ieee754_extended80_value_set(x, y) sets the value of x to
        !           498:    y, in IEEE 754 extended80 precision format (i.e., y is a struct tme_float_ieee754_extended80).  
        !           499:    (the internal function _tme_ieee754_extended80_value_set(x, t, y) 
        !           500:    takes the type of y, which must be compatible with struct tme_float_ieee754_extended80): */
        !           501: #define tme_ieee754_extended80_value_set(x, y) \
        !           502:   do { \
        !           503:     (x)->tme_float_value_ieee754_extended80 = (y); \
        !           504:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_EXTENDED80; \
        !           505:   } while (/* CONSTCOND */ 0)
        !           506: #define _tme_ieee754_extended80_value_set(x, t, y) \
        !           507:   do { \
        !           508:     *((t *) &(x)->tme_float_value_ieee754_extended80) = (y); \
        !           509:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_EXTENDED80; \
        !           510:   } while (/* CONSTCOND */ 0)
        !           511: 
        !           512: /* tme_ieee754_extended80_value_set_constant(x, y) sets the value of 
        !           513:    x to the constant y (i.e., y is a const struct tme_ieee754_extended80_constant *): */
        !           514: #define tme_ieee754_extended80_value_set_constant(x, y) \
        !           515:   do { \
        !           516:     (x)->tme_float_value_ieee754_extended80.tme_float_ieee754_extended80_sexp = (y)->tme_ieee754_extended80_constant_sexp; \
        !           517:     (x)->tme_float_value_ieee754_extended80.tme_float_ieee754_extended80_significand.tme_value64_uint32_hi = (y)->tme_ieee754_extended80_constant_significand_hi; \
        !           518:     (x)->tme_float_value_ieee754_extended80.tme_float_ieee754_extended80_significand.tme_value64_uint32_lo = (y)->tme_ieee754_extended80_constant_significand_lo; \
        !           519:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_EXTENDED80; \
        !           520:   } while (/* CONSTCOND */ 0)
        !           521: 
        !           522: /* tme_ieee754_extended80_value_builtin_get(x) returns the value of 
        !           523:    x as the builtin C type that is the best match for the IEEE 754
        !           524:    extended80 precision format: */
        !           525: #define tme_ieee754_extended80_value_builtin_get(x) \
        !           526:   (tme_ieee754_extended80_is_format_builtin(x) \
        !           527:    ? (x)->tme_float_value_ieee754_extended80_builtin \
        !           528:    : tme_ieee754_extended80_value_to_builtin(&(x)->tme_float_value_ieee754_extended80))
        !           529: 
        !           530: /* tme_ieee754_extended80_value_builtin_set(x, format, y) sets the value of
        !           531:    x to y, whose type is a builtin C type with format format.  if the value of
        !           532:    y is a NaN or an infinity, y is stored in x in IEEE 754 extended80
        !           533:    precision format, otherwise y is stored in x as the builtin C type 
        !           534:    that is the best match for the IEEE 754 extended80 precision format: */
        !           535: #define tme_ieee754_extended80_value_builtin_set(x, format, y) \
        !           536:   do { \
        !           537:     /* set the value: */ \
        !           538:     tme_float_value_builtin_set(x, format, y); \
        !           539:     \
        !           540:     /* if the result is a NaN: */ \
        !           541:     if (tme_float_is_nan(x, format)) { \
        !           542:       \
        !           543:       /* use the proper default IEEE 754 extended80 precision NaN: */ \
        !           544:       (x)->tme_float_value_ieee754_extended80 = ieee754_ctl->tme_ieee754_ctl_default_nan_extended80; \
        !           545:       (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_EXTENDED80; \
        !           546:     } \
        !           547:     \
        !           548:     /* otherwise, if the result isn't already in IEEE 754 extended80 precision format: */ \
        !           549:     else if ((format) != TME_FLOAT_FORMAT_IEEE754_EXTENDED80) { \
        !           550:       \
        !           551:       /* if the result is infinite: */ \
        !           552:       if (tme_float_is_inf(x, format)) { \
        !           553:         \
        !           554:        /* use the IEEE 754 extended80 precision infinity: */ \
        !           555:         (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_EXTENDED80; \
        !           556:        (x)->tme_float_value_ieee754_extended80.tme_float_ieee754_extended80_sexp = ((tme_uint32_t) 0x7fff) | (tme_float_is_negative(x, (format)) ? (((tme_uint32_t) 0x7fff) + _TME_FIELD_MASK_FACTOR(((tme_uint32_t) 0x7fff))) : 0); \
        !           557:        (x)->tme_float_value_ieee754_extended80.tme_float_ieee754_extended80_significand.tme_value64_uint32_hi = 0; \
        !           558:        (x)->tme_float_value_ieee754_extended80.tme_float_ieee754_extended80_significand.tme_value64_uint32_lo = 0; \
        !           559:       } \
        !           560:       \
        !           561:       /* otherwise, if the result isn't already the builtin C type that \
        !           562:          is the best match for the IEEE 754 extended80 precision format: */ \
        !           563:       else if ((format) != TME_FLOAT_FORMAT_IEEE754_EXTENDED80_BUILTIN) { \
        !           564:         \
        !           565:        /* convert the result: */ \
        !           566:        if ((format) == TME_FLOAT_FORMAT_FLOAT) { \
        !           567:          (x)->tme_float_value_ieee754_extended80_builtin = (x)->tme_float_value_float; \
        !           568:        } \
        !           569:         TME_FLOAT_IF_LONG_DOUBLE(else if ((format) == TME_FLOAT_FORMAT_LONG_DOUBLE) { \
        !           570:          (x)->tme_float_value_ieee754_extended80_builtin = (x)->tme_float_value_long_double; \
        !           571:        }) \
        !           572:        else { \
        !           573:          assert((format) == TME_FLOAT_FORMAT_DOUBLE); \
        !           574:          (x)->tme_float_value_ieee754_extended80_builtin = (x)->tme_float_value_double; \
        !           575:        } \
        !           576:       } \
        !           577:     } \
        !           578:   } while (/* CONSTCOND */ 0)
        !           579: 
        !           580: /* this converts a value from IEEE 754 extended80 precision format
        !           581:    into the builtin C type that is the best match for that format: */
        !           582: tme_ieee754_extended80_builtin_t tme_ieee754_extended80_value_to_builtin _TME_P((const struct tme_float_ieee754_extended80 *));
        !           583: 
        !           584: /* this converts a value from the builtin C type that is the best
        !           585:    match for the IEEE 754 extended80 precision format, into that
        !           586:    format: */
        !           587: const struct tme_float_ieee754_extended80 *tme_ieee754_extended80_value_from_builtin _TME_P((tme_ieee754_extended80_builtin_t, struct tme_float_ieee754_extended80 *));
        !           588: 
        !           589: /* this does a NaN check for an IEEE 754 extended80 precision monadic function: */
        !           590: int tme_ieee754_extended80_check_nan_monadic _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, struct tme_float *));
        !           591: 
        !           592: /* this does a NaN check for an IEEE 754 extended80 precision dyadic function: */
        !           593: int tme_ieee754_extended80_check_nan_dyadic _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, const struct tme_float *, struct tme_float *));
        !           594: 
        !           595: /* this converts a tme_uint32_t to a extended80: */
        !           596: void tme_ieee754_extended80_from_int32 _TME_P((tme_uint32_t, struct tme_float *));
        !           597: 
        !           598: #if defined(TME_HAVE_INT64_T)
        !           599: 
        !           600: /* this converts a tme_uint64_t to a extended80: */
        !           601: void tme_ieee754_extended80_from_int64 _TME_P((tme_uint64_t, struct tme_float *));
        !           602: 
        !           603: #endif /* defined(TME_HAVE_INT64_T) */
        !           604: 
        !           605: /* this converts an in-range IEEE 754 extended80 precision value into its
        !           606:    radix 10 mantissa and exponent.  the mantissa is either zero, or 
        !           607:    in the range [1,10): */
        !           608: void tme_ieee754_extended80_radix10_mantissa_exponent _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, struct tme_float *, struct tme_float *));
        !           609: 
        !           610: /* this scales an IEEE 754 extended80 precision value by adding n to its 
        !           611:    radix 10 exponent: */
        !           612: void tme_ieee754_extended80_radix10_scale _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, const struct tme_float *, struct tme_float *));
        !           613: 
        !           614: 
        !           615: /* decide which builtin C floating-point type is the best match for
        !           616:    the IEEE 754 quad precision format.  if a builtin type matches
        !           617:    this format exactly, use that type, otherwise we assume that the
        !           618:    smallest builtin type that is at least 16 bytes wide is the best
        !           619:    match.  if no builtin type is at least that wide, we use long
        !           620:    double, or double if long double is not available: */
        !           621: #if ((TME_FLOAT_FORMATS_BUILTIN & TME_FLOAT_FORMAT_IEEE754_QUAD) != 0)
        !           622: #define TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN TME_FLOAT_FORMAT_IEEE754_QUAD
        !           623: #elif (_TME_SIZEOF_FLOAT >= 16)
        !           624: #define TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN TME_FLOAT_FORMAT_FLOAT
        !           625: #elif (_TME_SIZEOF_DOUBLE >= 16 || !defined(_TME_HAVE_LONG_DOUBLE))
        !           626: #define TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN TME_FLOAT_FORMAT_DOUBLE
        !           627: #else
        !           628: #define TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN TME_FLOAT_FORMAT_LONG_DOUBLE
        !           629: #endif
        !           630: 
        !           631: /* typedef the builtin C floating-point type that is the best match
        !           632:    for the IEEE 754 quad precision format: */
        !           633: #if (TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN == TME_FLOAT_FORMAT_FLOAT)
        !           634: typedef float tme_ieee754_quad_builtin_t;
        !           635: #define tme_float_value_ieee754_quad_builtin tme_float_value_float
        !           636: #elif (TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN == TME_FLOAT_FORMAT_DOUBLE)
        !           637: typedef double tme_ieee754_quad_builtin_t;
        !           638: #define tme_float_value_ieee754_quad_builtin tme_float_value_double
        !           639: #elif (TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN == TME_FLOAT_FORMAT_LONG_DOUBLE)
        !           640: typedef long double tme_ieee754_quad_builtin_t;
        !           641: #define tme_float_value_ieee754_quad_builtin tme_float_value_long_double
        !           642: #endif
        !           643: 
        !           644: /* this asserts that the float is either in IEEE 754 quad
        !           645:    precision format, or in the best-match builtin type format.  it
        !           646:    evaluates to nonzero if the float is in IEEE 754 quad
        !           647:    precision format: */
        !           648: #define tme_ieee754_quad_is_format(x) \
        !           649:   (tme_float_assert_formats(x, \
        !           650:                             TME_FLOAT_FORMAT_IEEE754_QUAD | TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN) \
        !           651:    && tme_float_is_format(x, \
        !           652:                           TME_FLOAT_FORMAT_IEEE754_QUAD | TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN, \
        !           653:                          TME_FLOAT_FORMAT_IEEE754_QUAD))
        !           654: 
        !           655: /* this asserts that the float is either in IEEE 754 quad
        !           656:    precision format, or in the best-match builtin type format.  it
        !           657:    evaluates to nonzero if the float is in the best-match builtin 
        !           658:    type format: */
        !           659: #define tme_ieee754_quad_is_format_builtin(x) \
        !           660:   (tme_float_assert_formats(x, \
        !           661:                             TME_FLOAT_FORMAT_IEEE754_QUAD | TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN) \
        !           662:    && tme_float_is_format(x, \
        !           663:                           TME_FLOAT_FORMAT_IEEE754_QUAD | TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN, \
        !           664:                          TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN))
        !           665: 
        !           666: /* this asserts that the float is either in IEEE 754 quad
        !           667:    precision format, or in the best-match builtin type format.  it
        !           668:    evaluates to nonzero if the float is a NaN: */
        !           669: #define tme_ieee754_quad_is_nan(x) \
        !           670:   (tme_float_assert_formats(x, \
        !           671:                             TME_FLOAT_FORMAT_IEEE754_QUAD | TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN) \
        !           672:    && tme_float_is_nan(x, \
        !           673:                        TME_FLOAT_FORMAT_IEEE754_QUAD | TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN))
        !           674: 
        !           675: /* this asserts that the float is either in IEEE 754 quad
        !           676:    precision format, or in the best-match builtin type format.  it
        !           677:    evaluates to nonzero if the float is an infinity: */
        !           678: #define tme_ieee754_quad_is_inf(x) \
        !           679:   (tme_float_assert_formats(x, \
        !           680:                             TME_FLOAT_FORMAT_IEEE754_QUAD | TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN) \
        !           681:    && tme_float_is_inf(x, \
        !           682:                        TME_FLOAT_FORMAT_IEEE754_QUAD | TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN))
        !           683: 
        !           684: /* this asserts that the float is either in IEEE 754 quad
        !           685:    precision format, or in the best-match builtin type format.  it
        !           686:    evaluates to nonzero if the float is a zero: */
        !           687: #define tme_ieee754_quad_is_zero(x) \
        !           688:   (tme_float_assert_formats(x, \
        !           689:                             TME_FLOAT_FORMAT_IEEE754_QUAD | TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN) \
        !           690:    && tme_float_is_zero(x, \
        !           691:                         TME_FLOAT_FORMAT_IEEE754_QUAD | TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN))
        !           692: 
        !           693: /* tme_ieee754_quad_value_get(x, buffer) returns a pointer to
        !           694:    the value of x in IEEE 754 quad precision format (i.e., it 
        !           695:    returns a pointer to struct tme_float_ieee754_quad).  if x isn't already in this 
        !           696:    format, it is converted into that format in the given buffer: */
        !           697: #define tme_ieee754_quad_value_get(x, buffer) \
        !           698:   (tme_ieee754_quad_is_format(x) \
        !           699:    ? &(x)->tme_float_value_ieee754_quad \
        !           700:    : tme_ieee754_quad_value_from_builtin((x)->tme_float_value_ieee754_quad_builtin, buffer))
        !           701: 
        !           702: /* tme_ieee754_quad_value_set(x, y) sets the value of x to
        !           703:    y, in IEEE 754 quad precision format (i.e., y is a struct tme_float_ieee754_quad).  
        !           704:    (the internal function _tme_ieee754_quad_value_set(x, t, y) 
        !           705:    takes the type of y, which must be compatible with struct tme_float_ieee754_quad): */
        !           706: #define tme_ieee754_quad_value_set(x, y) \
        !           707:   do { \
        !           708:     (x)->tme_float_value_ieee754_quad = (y); \
        !           709:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_QUAD; \
        !           710:   } while (/* CONSTCOND */ 0)
        !           711: #define _tme_ieee754_quad_value_set(x, t, y) \
        !           712:   do { \
        !           713:     *((t *) &(x)->tme_float_value_ieee754_quad) = (y); \
        !           714:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_QUAD; \
        !           715:   } while (/* CONSTCOND */ 0)
        !           716: 
        !           717: /* tme_ieee754_quad_value_set_constant(x, y) sets the value of 
        !           718:    x to the constant y (i.e., y is a const struct tme_ieee754_quad_constant *): */
        !           719: #define tme_ieee754_quad_value_set_constant(x, y) \
        !           720:   do { \
        !           721:     (x)->tme_float_value_ieee754_quad.tme_float_ieee754_quad_hi.tme_value64_uint32_hi = (y)->tme_ieee754_quad_constant_hi_hi; \
        !           722:     (x)->tme_float_value_ieee754_quad.tme_float_ieee754_quad_hi.tme_value64_uint32_lo = (y)->tme_ieee754_quad_constant_hi_lo; \
        !           723:     (x)->tme_float_value_ieee754_quad.tme_float_ieee754_quad_lo.tme_value64_uint32_hi = (y)->tme_ieee754_quad_constant_lo_hi; \
        !           724:     (x)->tme_float_value_ieee754_quad.tme_float_ieee754_quad_lo.tme_value64_uint32_lo = (y)->tme_ieee754_quad_constant_lo_lo; \
        !           725:     (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_QUAD; \
        !           726:   } while (/* CONSTCOND */ 0)
        !           727: 
        !           728: /* tme_ieee754_quad_value_builtin_get(x) returns the value of 
        !           729:    x as the builtin C type that is the best match for the IEEE 754
        !           730:    quad precision format: */
        !           731: #define tme_ieee754_quad_value_builtin_get(x) \
        !           732:   (tme_ieee754_quad_is_format_builtin(x) \
        !           733:    ? (x)->tme_float_value_ieee754_quad_builtin \
        !           734:    : tme_ieee754_quad_value_to_builtin(&(x)->tme_float_value_ieee754_quad))
        !           735: 
        !           736: /* tme_ieee754_quad_value_builtin_set(x, format, y) sets the value of
        !           737:    x to y, whose type is a builtin C type with format format.  if the value of
        !           738:    y is a NaN or an infinity, y is stored in x in IEEE 754 quad
        !           739:    precision format, otherwise y is stored in x as the builtin C type 
        !           740:    that is the best match for the IEEE 754 quad precision format: */
        !           741: #define tme_ieee754_quad_value_builtin_set(x, format, y) \
        !           742:   do { \
        !           743:     /* set the value: */ \
        !           744:     tme_float_value_builtin_set(x, format, y); \
        !           745:     \
        !           746:     /* if the result is a NaN: */ \
        !           747:     if (tme_float_is_nan(x, format)) { \
        !           748:       \
        !           749:       /* use the proper default IEEE 754 quad precision NaN: */ \
        !           750:       (x)->tme_float_value_ieee754_quad = ieee754_ctl->tme_ieee754_ctl_default_nan_quad; \
        !           751:       (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_QUAD; \
        !           752:     } \
        !           753:     \
        !           754:     /* otherwise, if the result isn't already in IEEE 754 quad precision format: */ \
        !           755:     else if ((format) != TME_FLOAT_FORMAT_IEEE754_QUAD) { \
        !           756:       \
        !           757:       /* if the result is infinite: */ \
        !           758:       if (tme_float_is_inf(x, format)) { \
        !           759:         \
        !           760:        /* use the IEEE 754 quad precision infinity: */ \
        !           761:         (x)->tme_float_format = TME_FLOAT_FORMAT_IEEE754_QUAD; \
        !           762:        (x)->tme_float_value_ieee754_quad.tme_float_ieee754_quad_hi.tme_value64_uint32_hi = ((tme_uint32_t) 0x7fff0000) | (tme_float_is_negative(x, (format)) ? (((tme_uint32_t) 0x7fff0000) + _TME_FIELD_MASK_FACTOR(((tme_uint32_t) 0x7fff0000))) : 0); \
        !           763:        (x)->tme_float_value_ieee754_quad.tme_float_ieee754_quad_hi.tme_value64_uint32_lo = 0; \
        !           764:        (x)->tme_float_value_ieee754_quad.tme_float_ieee754_quad_lo.tme_value64_uint32_hi = 0; \
        !           765:        (x)->tme_float_value_ieee754_quad.tme_float_ieee754_quad_lo.tme_value64_uint32_lo = 0; \
        !           766:       } \
        !           767:       \
        !           768:       /* otherwise, if the result isn't already the builtin C type that \
        !           769:          is the best match for the IEEE 754 quad precision format: */ \
        !           770:       else if ((format) != TME_FLOAT_FORMAT_IEEE754_QUAD_BUILTIN) { \
        !           771:         \
        !           772:        /* convert the result: */ \
        !           773:        if ((format) == TME_FLOAT_FORMAT_FLOAT) { \
        !           774:          (x)->tme_float_value_ieee754_quad_builtin = (x)->tme_float_value_float; \
        !           775:        } \
        !           776:         TME_FLOAT_IF_LONG_DOUBLE(else if ((format) == TME_FLOAT_FORMAT_LONG_DOUBLE) { \
        !           777:          (x)->tme_float_value_ieee754_quad_builtin = (x)->tme_float_value_long_double; \
        !           778:        }) \
        !           779:        else { \
        !           780:          assert((format) == TME_FLOAT_FORMAT_DOUBLE); \
        !           781:          (x)->tme_float_value_ieee754_quad_builtin = (x)->tme_float_value_double; \
        !           782:        } \
        !           783:       } \
        !           784:     } \
        !           785:   } while (/* CONSTCOND */ 0)
        !           786: 
        !           787: /* this converts a value from IEEE 754 quad precision format
        !           788:    into the builtin C type that is the best match for that format: */
        !           789: tme_ieee754_quad_builtin_t tme_ieee754_quad_value_to_builtin _TME_P((const struct tme_float_ieee754_quad *));
        !           790: 
        !           791: /* this converts a value from the builtin C type that is the best
        !           792:    match for the IEEE 754 quad precision format, into that
        !           793:    format: */
        !           794: const struct tme_float_ieee754_quad *tme_ieee754_quad_value_from_builtin _TME_P((tme_ieee754_quad_builtin_t, struct tme_float_ieee754_quad *));
        !           795: 
        !           796: /* this does a NaN check for an IEEE 754 quad precision monadic function: */
        !           797: int tme_ieee754_quad_check_nan_monadic _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, struct tme_float *));
        !           798: 
        !           799: /* this does a NaN check for an IEEE 754 quad precision dyadic function: */
        !           800: int tme_ieee754_quad_check_nan_dyadic _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, const struct tme_float *, struct tme_float *));
        !           801: 
        !           802: /* this converts a tme_uint32_t to a quad: */
        !           803: void tme_ieee754_quad_from_int32 _TME_P((tme_uint32_t, struct tme_float *));
        !           804: 
        !           805: #if defined(TME_HAVE_INT64_T)
        !           806: 
        !           807: /* this converts a tme_uint64_t to a quad: */
        !           808: void tme_ieee754_quad_from_int64 _TME_P((tme_uint64_t, struct tme_float *));
        !           809: 
        !           810: #endif /* defined(TME_HAVE_INT64_T) */
        !           811: 
        !           812: /* this converts an in-range IEEE 754 quad precision value into its
        !           813:    radix 10 mantissa and exponent.  the mantissa is either zero, or 
        !           814:    in the range [1,10): */
        !           815: void tme_ieee754_quad_radix10_mantissa_exponent _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, struct tme_float *, struct tme_float *));
        !           816: 
        !           817: /* this scales an IEEE 754 quad precision value by adding n to its 
        !           818:    radix 10 exponent: */
        !           819: void tme_ieee754_quad_radix10_scale _TME_P((struct tme_ieee754_ctl *, const struct tme_float *, const struct tme_float *, struct tme_float *));
        !           820: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.