Changeset c0c38c7c in mainline for uspace/lib/math/include/mathtypes.h


Ignore:
Timestamp:
2015-03-14T21:36:44Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7f9d97f3
Parents:
2c7fdaa
Message:

software floating point overhaul
use proper type mapping
fix cosine calculation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/math/include/mathtypes.h

    r2c7fdaa rc0c38c7c  
    191191#endif
    192192
    193 typedef union {
    194         float val;
    195        
     193
    196194#if defined(FLOAT_SIZE_32)
     195
     196#ifndef float32_t
     197        #define float32_t  float
     198#endif
     199
     200#elif defined(FLOAT_SIZE_64)
     201
     202#ifndef float64_t
     203        #define float64_t  float
     204#endif
     205
     206#elif defined(FLOAT_SIZE_96)
     207
     208#ifndef float96_t
     209        #define float96_t  float
     210#endif
     211
     212#elif defined(FLOAT_SIZE_128)
     213
     214#ifndef float128_t
     215        #define float128_t  float
     216#endif
     217
     218#endif
     219
     220
     221#if defined(DOUBLE_SIZE_32)
     222
     223#ifndef float32_t
     224        #define float32_t  double
     225#endif
     226
     227#elif defined(DOUBLE_SIZE_64)
     228
     229#ifndef float64_t
     230        #define float64_t  double
     231#endif
     232
     233#elif defined(DOUBLE_SIZE_96)
     234
     235#ifndef float96_t
     236        #define float96_t  double
     237#endif
     238
     239#elif defined(DOUBLE_SIZE_128)
     240
     241#ifndef float128_t
     242        #define float128_t  double
     243#endif
     244
     245#endif
     246
     247
     248#if defined(LONG_DOUBLE_SIZE_32)
     249
     250#ifndef float32_t
     251        #define float32_t  long double
     252#endif
     253
     254#elif defined(LONG_DOUBLE_SIZE_64)
     255
     256#ifndef float64_t
     257        #define float64_t  long double
     258#endif
     259
     260#elif defined(LONG_DOUBLE_SIZE_96)
     261
     262#ifndef float96_t
     263        #define float96_t  long double
     264#endif
     265
     266#elif defined(LONG_DOUBLE_SIZE_128)
     267
     268#ifndef float128_t
     269        #define float128_t  long double
     270#endif
     271
     272#endif
     273
     274
     275#ifdef float32_t
     276
     277typedef union {
     278        float32_t val;
    197279        float32 data;
    198 #elif defined(FLOAT_SIZE_64)
     280} float32_u;
     281
     282#endif
     283
     284#ifdef float64_t
     285
     286typedef union {
     287        float64_t val;
    199288        float64 data;
    200 #elif defined(FLOAT_SIZE_96)
     289} float64_u;
     290
     291#endif
     292
     293#ifdef float96_t
     294
     295typedef union {
     296        float96_t val;
    201297        float96 data;
    202 #elif defined(FLOAT_SIZE_128)
     298} float96_u;
     299
     300#endif
     301
     302#ifdef float128_t
     303
     304typedef union {
     305        float128_t val;
    203306        float128 data;
    204 #else
    205         #error Unsupported float size
    206 #endif
    207 } float_t;
    208 
    209 typedef union {
    210         double val;
    211        
    212 #if defined(DOUBLE_SIZE_32)
    213         float32 data;
    214 #elif defined(DOUBLE_SIZE_64)
    215         float64 data;
    216 #elif defined(DOUBLE_SIZE_96)
    217         float96 data;
    218 #elif defined(DOUBLE_SIZE_128)
    219         float128 data;
    220 #else
    221         #error Unsupported double size
    222 #endif
    223 } double_t;
    224 
    225 typedef union {
    226         long double val;
    227        
    228 #if defined(LONG_DOUBLE_SIZE_32)
    229         float32 data;
    230 #elif defined(LONG_DOUBLE_SIZE_64)
    231         float64 data;
    232 #elif defined(LONG_DOUBLE_SIZE_96)
    233         float96 data;
    234 #elif defined(LONG_DOUBLE_SIZE_128)
    235         float128 data;
    236 #else
    237         #error Unsupported long double size
    238 #endif
    239 } long_double_t;
     307} float128_u;
     308
     309#endif
    240310
    241311#endif
Note: See TracChangeset for help on using the changeset viewer.