source: trunk/src/real.h @ 965

Last change on this file since 965 was 965, checked in by sam, 11 years ago

core: start working on a "real" class for arbitrarily sized floats.

File size: 762 bytes
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 Real class
13// --------------
14//
15
16#if !defined __LOL_REAL_H__
17#define __LOL_REAL_H__
18
19#include <stdint.h>
20
21namespace lol
22{
23
24template<int NBITS> class Real
25{
26public:
27    inline Real<NBITS>() {}
28    Real<NBITS>(float f);
29
30    operator float() const;
31
32private:
33    uint32_t m_signexp;
34    uint32_t m_mantissa[(NBITS + 31) / 32];
35};
36
37typedef Real<4096> real4k;
38
39} /* namespace lol */
40
41#endif // __LOL_REAL_H__
42
Note: See TracBrowser for help on using the repository browser.