source: trunk/src/core.h @ 940

Last change on this file since 940 was 940, checked in by sam, 12 years ago

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

  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1//
2// Lol Engine
3//
4// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
5//   This program is free software; you can redistribute it and/or
6//   modify it under the terms of the Do What The Fuck You Want To
7//   Public License, Version 2, as published by Sam Hocevar. See
8//   http://sam.zoy.org/projects/COPYING.WTFPL for more details.
9//
10
11//
12// The main header
13// ---------------
14//
15
16#if !defined __LOL_CORE_H__
17#define __LOL_CORE_H__
18
19// CPU features
20#undef LOL_FEATURE_CHEAP_BRANCHES
21#undef LOL_FEATURE_VERY_CHEAP_BRANCHES
22
23#if !defined __CELLOS_LV2__
24#   define LOL_FEATURE_CHEAP_BRANCHES
25#endif
26
27// Optimisation helpers
28#if defined __GNUC__
29#   define __likely(x)   __builtin_expect(!!(x), 1)
30#   define __unlikely(x) __builtin_expect(!!(x), 0)
31#   define INLINEATTR __attribute__((always_inline))
32#   if defined __CELLOS_LV2__
33#      define FP_USE(x) __asm__("" : "+f" (x))
34#   elif defined __x86_64__
35#      define FP_USE(x) __asm__("" : "+x" (x))
36#   elif defined __i386__ /* FIXME: this isn't good */
37#      define FP_USE(x) __asm__("" : "+m" (x))
38#   else
39#      define FP_USE(x) (void)(x)
40#   endif
41#else
42#   define __likely(x)   x
43#   define __unlikely(x) x
44#   define INLINEATTR
45#   define FP_USE(x) (void)(x)
46#endif
47
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
63// Base types
64#include "trig.h"
65#include "half.h"
66#include "matrix.h"
67#include "numeric.h"
68#include "timer.h"
69
70// Static classes
71#include "log.h"
72#include "platform.h"
73#include "video.h"
74#include "audio.h"
75#include "scene.h"
76#include "input.h"
77#include "profiler.h"
78
79// Entities
80#include "entity.h"
81#include "worldentity.h"
82
83#include "emitter.h"
84#include "font.h"
85#include "gradient.h"
86#include "sample.h"
87#include "sprite.h"
88#include "text.h"
89#include "tileset.h"
90#include "world.h"
91
92// Other objects
93#include "hash.h"
94#include "dict.h"
95#include "map.h"
96#include "layer.h"
97#include "shader/shader.h"
98#include "image/image.h"
99
100// Managers
101#include "ticker.h"
102#include "forge.h"
103#include "tiler.h"
104#include "sampler.h"
105
106#endif // __LOL_CORE_H__
107
Note: See TracBrowser for help on using the repository browser.