Changeset 940


Ignore:
Timestamp:
Sep 10, 2011, 4:55:44 PM (8 years ago)
Author:
sam
Message:

core: add our custom isnan() macro to the core headers.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core.h

    r923 r940  
    4646#endif
    4747
     48/* Ensure isnan() is present even on systems that don't define it, or
     49 * when -ffast-math is being used. */
     50#if defined __FAST_MATH__
     51#   undef isnan
     52#endif
     53#if !defined isnan
     54#   define isnan isnan
     55#   include <stdint.h>
     56static inline int isnan(float f)
     57{
     58    union { float f; uint32_t x; } u = { f };
     59    return (u.x << 1) > 0xff000000u;
     60}
     61#endif
     62
    4863// Base types
    4964#include "trig.h"
  • trunk/test/half.cpp

    r937 r940  
    1717#include "core.h"
    1818#include "lol/unit.h"
    19 
    20 /* Ensure isnan() is present even on systems that don't define it, or
    21  * when -ffast-math is being used. */
    22 #if defined __FAST_MATH__
    23 #   undef isnan
    24 #endif
    25 #if !defined isnan
    26 static inline int isnan(float f)
    27 {
    28     union { float f; uint32_t x; } u = { f };
    29     return (u.x << 1) > 0xff000000u;
    30 }
    31 #endif
    3219
    3320namespace lol
Note: See TracChangeset for help on using the changeset viewer.