Ignore:
Timestamp:
2009-06-18T08:30:50Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
12956e57
Parents:
553492be
Message:

define endianess externally to be able to exactly specify whether we are using UTF-32LE or UTF-32BE
quit messing with BOM in UTF-32

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/softfloat/include/sftypes.h

    r553492be rac47b7c2  
    2727 */
    2828
    29  /** @addtogroup softfloat     
     29/** @addtogroup softfloat
    3030 * @{
    3131 */
     
    4242        float f;
    4343        uint32_t binary;
    44 
    45         struct  {
    46 #if defined(ARCH_IS_BIG_ENDIAN)
    47                 uint32_t sign:1;
    48                 uint32_t exp:8;
    49                 uint32_t fraction:23;
    50 #elif defined(ARCH_IS_LITTLE_ENDIAN)
    51                 uint32_t fraction:23;
    52                 uint32_t exp:8;
    53                 uint32_t sign:1;
    54 #else 
    55 #error "Unknown endians."
     44       
     45        struct {
     46#if defined(__BE__)
     47                uint32_t sign : 1;
     48                uint32_t exp : 8;
     49                uint32_t fraction : 23;
     50#elif defined(__LE__)
     51                uint32_t fraction : 23;
     52                uint32_t exp : 8;
     53                uint32_t sign : 1;
     54#else
     55        #error Unknown endianess
    5656#endif
    5757                } parts __attribute__ ((packed));
    58         } float32;
    59        
     58} float32;
     59
    6060typedef union {
    6161        double d;
    6262        uint64_t binary;
    6363       
    64         struct  {
    65 #if defined(ARCH_IS_BIG_ENDIAN)
    66                 uint64_t sign:1;
    67                 uint64_t exp:11;
    68                 uint64_t fraction:52;
    69 #elif defined(ARCH_IS_LITTLE_ENDIAN)
    70                 uint64_t fraction:52;
    71                 uint64_t exp:11;
    72                 uint64_t sign:1;
    73 #else 
    74 #error "Unknown endians."
     64        struct {
     65#if defined(__BE__)
     66                uint64_t sign : 1;
     67                uint64_t exp : 11;
     68                uint64_t fraction : 52;
     69#elif defined(__LE__)
     70                uint64_t fraction : 52;
     71                uint64_t exp : 11;
     72                uint64_t sign : 1;
     73#else
     74        #error Unknown endianess
    7575#endif
    76                 } parts __attribute__ ((packed));
    77         } float64;
     76        } parts __attribute__ ((packed));
     77} float64;
    7878
    7979#define FLOAT32_MAX 0x7f800000
     
    110110#endif
    111111
    112 
    113  /** @}
     112/** @}
    114113 */
    115 
Note: See TracChangeset for help on using the changeset viewer.