This library contains code that extends and simplifies different operations
for C language based programs.
Revisión | 470e86c1363ebd039a26f91ef9a696e955f3a5c6 (tree) |
---|---|
Tiempo | 2023-03-10 07:20:01 |
Autor | Sergey Gusarov <laborer2008@gmai...> |
Commiter | Sergey Gusarov |
"int roundf*()" functions renamed to iroundf*() because of conflict with
system functions like "float roundf32(float)"
@@ -97,7 +97,7 @@ | ||
97 | 97 | |
98 | 98 | CT_BEGIN_NAMESPACE |
99 | 99 | |
100 | -static CT_FORCEINLINE int8_t roundf8(const float x) CT_NOEXCEPT | |
100 | +static CT_FORCEINLINE int8_t iroundf8(const float x) CT_NOEXCEPT | |
101 | 101 | { |
102 | 102 | return CT_SIMPLE_ROUNDF8(x); |
103 | 103 | } |
@@ -107,7 +107,7 @@ | ||
107 | 107 | return CT_SIMPLE_UROUNDF8(x); |
108 | 108 | } |
109 | 109 | |
110 | -static CT_FORCEINLINE int16_t roundf16(const float x) CT_NOEXCEPT | |
110 | +static CT_FORCEINLINE int16_t iroundf16(const float x) CT_NOEXCEPT | |
111 | 111 | { |
112 | 112 | return CT_SIMPLE_ROUNDF16(x); |
113 | 113 | } |
@@ -117,7 +117,7 @@ | ||
117 | 117 | return CT_SIMPLE_UROUNDF16(x); |
118 | 118 | } |
119 | 119 | |
120 | -static CT_FORCEINLINE int32_t roundf32(const float x) CT_NOEXCEPT | |
120 | +static CT_FORCEINLINE int32_t iroundf32(const float x) CT_NOEXCEPT | |
121 | 121 | { |
122 | 122 | return CT_SIMPLE_ROUNDF32(x); |
123 | 123 | } |
@@ -128,7 +128,7 @@ | ||
128 | 128 | } |
129 | 129 | |
130 | 130 | #ifndef CT_NO_64 |
131 | -static CT_FORCEINLINE int64_t roundf64(const float x) CT_NOEXCEPT | |
131 | +static CT_FORCEINLINE int64_t iroundf64(const float x) CT_NOEXCEPT | |
132 | 132 | { |
133 | 133 | return CT_SIMPLE_ROUNDF64(x); |
134 | 134 | } |
@@ -141,7 +141,7 @@ | ||
141 | 141 | |
142 | 142 | #ifdef CT_COMPL_SDCC |
143 | 143 | |
144 | -static inline int8_t round8(const float x) CT_NOEXCEPT | |
144 | +static inline int8_t iround8(const float x) CT_NOEXCEPT | |
145 | 145 | { |
146 | 146 | return roundf8(x); |
147 | 147 | } |
@@ -151,7 +151,7 @@ | ||
151 | 151 | return uroundf8(x); |
152 | 152 | } |
153 | 153 | |
154 | -static inline int16_t round16(const float x) CT_NOEXCEPT | |
154 | +static inline int16_t iround16(const float x) CT_NOEXCEPT | |
155 | 155 | { |
156 | 156 | return roundf16(x); |
157 | 157 | } |
@@ -161,7 +161,7 @@ | ||
161 | 161 | return uround16(x); |
162 | 162 | } |
163 | 163 | |
164 | -static inline int32_t round32(const float x) CT_NOEXCEPT | |
164 | +static inline int32_t iround32(const float x) CT_NOEXCEPT | |
165 | 165 | { |
166 | 166 | return roundf32(x); |
167 | 167 | } |
@@ -172,7 +172,7 @@ | ||
172 | 172 | } |
173 | 173 | |
174 | 174 | # ifndef CT_NO_64 |
175 | -static inline int64_t round64(const float x) CT_NOEXCEPT | |
175 | +static inline int64_t iround64(const float x) CT_NOEXCEPT | |
176 | 176 | { |
177 | 177 | return roundf64(x); |
178 | 178 | } |
@@ -185,7 +185,7 @@ | ||
185 | 185 | |
186 | 186 | #else |
187 | 187 | |
188 | -static CT_FORCEINLINE int8_t round8(const double x) CT_NOEXCEPT | |
188 | +static CT_FORCEINLINE int8_t iround8(const double x) CT_NOEXCEPT | |
189 | 189 | { |
190 | 190 | return CT_SIMPLE_ROUND8(x); |
191 | 191 | } |
@@ -195,7 +195,7 @@ | ||
195 | 195 | return CT_SIMPLE_UROUND8(x); |
196 | 196 | } |
197 | 197 | |
198 | -static CT_FORCEINLINE int16_t round16(const double x) CT_NOEXCEPT | |
198 | +static CT_FORCEINLINE int16_t iround16(const double x) CT_NOEXCEPT | |
199 | 199 | { |
200 | 200 | return CT_SIMPLE_ROUND16(x); |
201 | 201 | } |
@@ -205,7 +205,7 @@ | ||
205 | 205 | return CT_SIMPLE_UROUND16(x); |
206 | 206 | } |
207 | 207 | |
208 | -static CT_FORCEINLINE int32_t round32(const double x) CT_NOEXCEPT | |
208 | +static CT_FORCEINLINE int32_t iround32(const double x) CT_NOEXCEPT | |
209 | 209 | { |
210 | 210 | return CT_SIMPLE_ROUND32(x); |
211 | 211 | } |
@@ -216,7 +216,7 @@ | ||
216 | 216 | } |
217 | 217 | |
218 | 218 | # ifndef CT_NO_64 |
219 | -static CT_FORCEINLINE int64_t round64(const double x) CT_NOEXCEPT | |
219 | +static CT_FORCEINLINE int64_t iround64(const double x) CT_NOEXCEPT | |
220 | 220 | { |
221 | 221 | return CT_SIMPLE_ROUND64(x); |
222 | 222 | } |
@@ -56,35 +56,35 @@ | ||
56 | 56 | |
57 | 57 | void testCompileExtensionRound(void) |
58 | 58 | { |
59 | - TEST_ASSERT_EQUAL_INT8(roundf8(1.5f), 2); | |
59 | + TEST_ASSERT_EQUAL_INT8(iroundf8(1.5f), 2); | |
60 | 60 | TEST_ASSERT_EQUAL_UINT8(uroundf8(1.5f), 2U); |
61 | 61 | |
62 | - TEST_ASSERT_EQUAL_INT16(roundf16(1.5f), 2); | |
62 | + TEST_ASSERT_EQUAL_INT16(iroundf16(1.5f), 2); | |
63 | 63 | TEST_ASSERT_EQUAL_UINT16(uroundf16(1.5f), 2U); |
64 | 64 | |
65 | - TEST_ASSERT_EQUAL_INT32(roundf32(1.5f), 2); | |
65 | + TEST_ASSERT_EQUAL_INT32(iroundf32(1.5f), 2); | |
66 | 66 | TEST_ASSERT_EQUAL_UINT32(uroundf32(1.5f), 2U); |
67 | 67 | |
68 | 68 | #ifndef CT_NO_64 |
69 | 69 | # if defined (UNITY_INCLUDE_64) || (UNITY_LONG_WIDTH == 64) |
70 | - TEST_ASSERT_EQUAL_INT64(roundf64(1.5f), 2); | |
70 | + TEST_ASSERT_EQUAL_INT64(iroundf64(1.5f), 2); | |
71 | 71 | TEST_ASSERT_EQUAL_UINT64(uroundf64(1.5f), 2U); |
72 | 72 | # endif |
73 | 73 | #endif |
74 | 74 | |
75 | 75 | |
76 | - TEST_ASSERT_EQUAL_INT8(round8(1.5), 2); | |
76 | + TEST_ASSERT_EQUAL_INT8(iround8(1.5), 2); | |
77 | 77 | TEST_ASSERT_EQUAL_UINT8(uround8(1.5), 2U); |
78 | 78 | |
79 | - TEST_ASSERT_EQUAL_INT16(round16(1.5), 2); | |
79 | + TEST_ASSERT_EQUAL_INT16(iround16(1.5), 2); | |
80 | 80 | TEST_ASSERT_EQUAL_UINT16(uround16(1.5), 2U); |
81 | 81 | |
82 | - TEST_ASSERT_EQUAL_INT32(round32(1.5), 2); | |
82 | + TEST_ASSERT_EQUAL_INT32(iround32(1.5), 2); | |
83 | 83 | TEST_ASSERT_EQUAL_UINT32(uround32(1.5), 2U); |
84 | 84 | |
85 | 85 | #ifndef CT_NO_64 |
86 | 86 | # if defined (UNITY_INCLUDE_64) || (UNITY_LONG_WIDTH == 64) |
87 | - TEST_ASSERT_EQUAL_INT64(round64(1.5), 2); | |
87 | + TEST_ASSERT_EQUAL_INT64(iround64(1.5), 2); | |
88 | 88 | TEST_ASSERT_EQUAL_UINT64(uround64(1.5), 2U); |
89 | 89 | # endif |
90 | 90 | #endif |