aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/include/eina_fp.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/eina/src/include/eina_fp.h
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to '')
-rw-r--r--libraries/eina/src/include/eina_fp.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/libraries/eina/src/include/eina_fp.h b/libraries/eina/src/include/eina_fp.h
new file mode 100644
index 0000000..c73dc16
--- /dev/null
+++ b/libraries/eina/src/include/eina_fp.h
@@ -0,0 +1,111 @@
1/* EINA - EFL data type library
2 * Copyright (C) 2007-2008 Jorge Luis Zapata Muga
3 * Copyright (C) 2009 Cedric BAIL
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library;
17 * if not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef EINA_FP_H_
21# define EINA_FP_H_
22
23#include "eina_types.h"
24
25#ifdef _MSC_VER
26typedef unsigned __int64 uint64_t;
27typedef signed __int64 int64_t;
28typedef signed int int32_t;
29#else
30# include <stdint.h>
31#endif
32
33#define EINA_F32P32_PI 0x00000003243f6a89
34
35typedef int64_t Eina_F32p32;
36typedef int32_t Eina_F16p16;
37typedef int32_t Eina_F8p24;
38
39static inline Eina_F32p32 eina_f32p32_int_from(int32_t v);
40static inline int32_t eina_f32p32_int_to(Eina_F32p32 v);
41static inline Eina_F32p32 eina_f32p32_double_from(double v);
42static inline double eina_f32p32_double_to(Eina_F32p32 v);
43
44static inline Eina_F32p32 eina_f32p32_add(Eina_F32p32 a,
45 Eina_F32p32 b);
46static inline Eina_F32p32 eina_f32p32_sub(Eina_F32p32 a,
47 Eina_F32p32 b);
48static inline Eina_F32p32 eina_f32p32_mul(Eina_F32p32 a,
49 Eina_F32p32 b);
50static inline Eina_F32p32 eina_f32p32_scale(Eina_F32p32 a,
51 int b);
52static inline Eina_F32p32 eina_f32p32_div(Eina_F32p32 a,
53 Eina_F32p32 b);
54static inline Eina_F32p32 eina_f32p32_sqrt(Eina_F32p32 a);
55static inline unsigned int eina_f32p32_fracc_get(Eina_F32p32 v);
56
57// dont use llabs - issues if not on 64bit
58#define eina_fp32p32_llabs(a) ((a < 0) ? -(a) : (a))
59
60EAPI Eina_F32p32 eina_f32p32_cos(Eina_F32p32 a);
61EAPI Eina_F32p32 eina_f32p32_sin(Eina_F32p32 a);
62
63static inline Eina_F16p16 eina_f16p16_int_from(int32_t v);
64static inline int32_t eina_f16p16_int_to(Eina_F16p16 v);
65static inline Eina_F16p16 eina_f16p16_float_from(float v);
66static inline float eina_f16p16_float_to(Eina_F16p16 v);
67
68static inline Eina_F16p16 eina_f16p16_add(Eina_F16p16 a,
69 Eina_F16p16 b);
70static inline Eina_F16p16 eina_f16p16_sub(Eina_F16p16 a,
71 Eina_F16p16 b);
72static inline Eina_F16p16 eina_f16p16_mul(Eina_F16p16 a,
73 Eina_F16p16 b);
74static inline Eina_F16p16 eina_f16p16_scale(Eina_F16p16 a,
75 int b);
76static inline Eina_F16p16 eina_f16p16_div(Eina_F16p16 a,
77 Eina_F16p16 b);
78static inline Eina_F16p16 eina_f16p16_sqrt(Eina_F16p16 a);
79static inline unsigned int eina_f16p16_fracc_get(Eina_F16p16 v);
80
81static inline Eina_F8p24 eina_f8p24_int_from(int32_t v);
82static inline int32_t eina_f8p24_int_to(Eina_F8p24 v);
83static inline Eina_F8p24 eina_f8p24_float_from(float v);
84static inline float eina_f8p24_float_to(Eina_F8p24 v);
85
86static inline Eina_F8p24 eina_f8p24_add(Eina_F8p24 a,
87 Eina_F8p24 b);
88static inline Eina_F8p24 eina_f8p24_sub(Eina_F8p24 a,
89 Eina_F8p24 b);
90static inline Eina_F8p24 eina_f8p24_mul(Eina_F8p24 a,
91 Eina_F8p24 b);
92static inline Eina_F8p24 eina_f8p24_scale(Eina_F8p24 a,
93 int b);
94static inline Eina_F8p24 eina_f8p24_div(Eina_F8p24 a,
95 Eina_F8p24 b);
96static inline Eina_F8p24 eina_f8p24_sqrt(Eina_F8p24 a);
97static inline unsigned int eina_f8p24_fracc_get(Eina_F8p24 v);
98
99static inline Eina_F32p32 eina_f16p16_to_f32p32(Eina_F16p16 a);
100static inline Eina_F32p32 eina_f8p24_to_f32p32(Eina_F8p24 a);
101static inline Eina_F16p16 eina_f32p32_to_f16p16(Eina_F32p32 a);
102static inline Eina_F16p16 eina_f8p24_to_f16p16(Eina_F8p24 a);
103static inline Eina_F8p24 eina_f32p32_to_f8p24(Eina_F32p32 a);
104static inline Eina_F8p24 eina_f16p16_to_f8p24(Eina_F16p16 a);
105
106#include "eina_inline_f32p32.x"
107#include "eina_inline_f16p16.x"
108#include "eina_inline_f8p24.x"
109#include "eina_inline_fp.x"
110
111#endif