source: trunk/src/real.h @ 969

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

core: switch real mantissa to uint16_t instead of uint32_t to ease the
multiplication.

File size: 813 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
24class real
25{
26    static int const BIGITS = 10;
27
28public:
29    inline real() { }
30    real(float f);
31
32    operator float() const;
33    real operator *(real const &x) const;
34
35    void print() const;
36
37private:
38    uint32_t m_size;
39    uint32_t m_signexp;
40    uint16_t m_mantissa[BIGITS];
41};
42
43} /* namespace lol */
44
45#endif // __LOL_REAL_H__
46
Note: See TracBrowser for help on using the repository browser.