aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/include/eina_inline_fp.x
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/eina/src/include/eina_inline_fp.x')
-rw-r--r--libraries/eina/src/include/eina_inline_fp.x153
1 files changed, 0 insertions, 153 deletions
diff --git a/libraries/eina/src/include/eina_inline_fp.x b/libraries/eina/src/include/eina_inline_fp.x
deleted file mode 100644
index de44123..0000000
--- a/libraries/eina/src/include/eina_inline_fp.x
+++ /dev/null
@@ -1,153 +0,0 @@
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_INLINE_FP_X_
21# define EINA_INLINE_FP_X_
22
23static inline Eina_F32p32
24eina_f32p32_int_from(int32_t v)
25{
26 return (Eina_F32p32)(v) << 32;
27}
28
29static inline int32_t
30eina_f32p32_int_to(Eina_F32p32 v)
31{
32 return (int32_t)(v >> 32);
33}
34
35static inline Eina_F32p32
36eina_f32p32_double_from(double v)
37{
38 Eina_F32p32 r;
39 r = (Eina_F32p32)(v * 4294967296.0 + (v < 0 ? -0.5 : 0.5));
40 return r;
41}
42
43static inline double
44eina_f32p32_double_to(Eina_F32p32 v)
45{
46 double r;
47 r = v / 4294967296.0;
48 return r;
49}
50
51
52
53static inline Eina_F16p16
54eina_f16p16_int_from(int32_t v)
55{
56 return v << 16;
57}
58
59static inline int32_t
60eina_f16p16_int_to(Eina_F16p16 v)
61{
62 return v >> 16;
63}
64
65static inline Eina_F16p16
66eina_f16p16_float_from(float v)
67{
68 Eina_F16p16 r;
69
70 r = (Eina_F16p16)(v * 65536.0f + (v < 0 ? -0.5f : 0.5f));
71 return r;
72}
73
74static inline float
75eina_f16p16_float_to(Eina_F16p16 v)
76{
77 float r;
78
79 r = v / 65536.0f;
80 return r;
81}
82
83
84
85static inline Eina_F8p24
86eina_f8p24_int_from(int32_t v)
87{
88 return v << 24;
89}
90
91static inline int32_t
92eina_f8p24_int_to(Eina_F8p24 v)
93{
94 return v >> 24;
95}
96
97static inline Eina_F8p24
98eina_f8p24_float_from(float v)
99{
100 Eina_F8p24 r;
101
102 r = (Eina_F8p24)(v * 16777216.0f + (v < 0 ? -0.5f : 0.5f));
103 return r;
104}
105
106static inline float
107eina_f8p24_float_to(Eina_F8p24 v)
108{
109 float r;
110
111 r = v / 16777216.0f;
112 return r;
113}
114
115
116
117static inline Eina_F32p32
118eina_f16p16_to_f32p32(Eina_F16p16 a)
119{
120 return ((Eina_F32p32) a) << 16;
121}
122
123static inline Eina_F32p32
124eina_f8p24_to_f32p32(Eina_F8p24 a)
125{
126 return ((Eina_F32p32) a) << 8;
127}
128
129static inline Eina_F16p16
130eina_f32p32_to_f16p16(Eina_F32p32 a)
131{
132 return (Eina_F16p16) (a >> 16);
133}
134
135static inline Eina_F16p16
136eina_f8p24_to_f16p16(Eina_F8p24 a)
137{
138 return (Eina_F16p16) (a >> 8);
139}
140
141static inline Eina_F8p24
142eina_f32p32_to_f8p24(Eina_F32p32 a)
143{
144 return (Eina_F8p24) (a >> 8);
145}
146
147static inline Eina_F8p24
148eina_f16p16_to_f8p24(Eina_F16p16 a)
149{
150 return (Eina_F8p24) (a << 8);
151}
152
153#endif