• R/O
  • SSH

libctools: Commit

This library contains code that extends and simplifies different operations
for C language based programs.


Commit MetaInfo

Revisión470e86c1363ebd039a26f91ef9a696e955f3a5c6 (tree)
Tiempo2023-03-10 07:20:01
AutorSergey Gusarov <laborer2008@gmai...>
CommiterSergey Gusarov

Log Message

"int roundf*()" functions renamed to iroundf*() because of conflict with
system functions like "float roundf32(float)"

Cambiar Resumen

Diferencia incremental

diff -r 34e2659008ad -r 470e86c1363e include/ctools/std/math.h
--- a/include/ctools/std/math.h Sun Feb 26 01:22:14 2023 +0300
+++ b/include/ctools/std/math.h Fri Mar 10 01:20:01 2023 +0300
@@ -97,7 +97,7 @@
9797
9898 CT_BEGIN_NAMESPACE
9999
100-static CT_FORCEINLINE int8_t roundf8(const float x) CT_NOEXCEPT
100+static CT_FORCEINLINE int8_t iroundf8(const float x) CT_NOEXCEPT
101101 {
102102 return CT_SIMPLE_ROUNDF8(x);
103103 }
@@ -107,7 +107,7 @@
107107 return CT_SIMPLE_UROUNDF8(x);
108108 }
109109
110-static CT_FORCEINLINE int16_t roundf16(const float x) CT_NOEXCEPT
110+static CT_FORCEINLINE int16_t iroundf16(const float x) CT_NOEXCEPT
111111 {
112112 return CT_SIMPLE_ROUNDF16(x);
113113 }
@@ -117,7 +117,7 @@
117117 return CT_SIMPLE_UROUNDF16(x);
118118 }
119119
120-static CT_FORCEINLINE int32_t roundf32(const float x) CT_NOEXCEPT
120+static CT_FORCEINLINE int32_t iroundf32(const float x) CT_NOEXCEPT
121121 {
122122 return CT_SIMPLE_ROUNDF32(x);
123123 }
@@ -128,7 +128,7 @@
128128 }
129129
130130 #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
132132 {
133133 return CT_SIMPLE_ROUNDF64(x);
134134 }
@@ -141,7 +141,7 @@
141141
142142 #ifdef CT_COMPL_SDCC
143143
144-static inline int8_t round8(const float x) CT_NOEXCEPT
144+static inline int8_t iround8(const float x) CT_NOEXCEPT
145145 {
146146 return roundf8(x);
147147 }
@@ -151,7 +151,7 @@
151151 return uroundf8(x);
152152 }
153153
154-static inline int16_t round16(const float x) CT_NOEXCEPT
154+static inline int16_t iround16(const float x) CT_NOEXCEPT
155155 {
156156 return roundf16(x);
157157 }
@@ -161,7 +161,7 @@
161161 return uround16(x);
162162 }
163163
164-static inline int32_t round32(const float x) CT_NOEXCEPT
164+static inline int32_t iround32(const float x) CT_NOEXCEPT
165165 {
166166 return roundf32(x);
167167 }
@@ -172,7 +172,7 @@
172172 }
173173
174174 # 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
176176 {
177177 return roundf64(x);
178178 }
@@ -185,7 +185,7 @@
185185
186186 #else
187187
188-static CT_FORCEINLINE int8_t round8(const double x) CT_NOEXCEPT
188+static CT_FORCEINLINE int8_t iround8(const double x) CT_NOEXCEPT
189189 {
190190 return CT_SIMPLE_ROUND8(x);
191191 }
@@ -195,7 +195,7 @@
195195 return CT_SIMPLE_UROUND8(x);
196196 }
197197
198-static CT_FORCEINLINE int16_t round16(const double x) CT_NOEXCEPT
198+static CT_FORCEINLINE int16_t iround16(const double x) CT_NOEXCEPT
199199 {
200200 return CT_SIMPLE_ROUND16(x);
201201 }
@@ -205,7 +205,7 @@
205205 return CT_SIMPLE_UROUND16(x);
206206 }
207207
208-static CT_FORCEINLINE int32_t round32(const double x) CT_NOEXCEPT
208+static CT_FORCEINLINE int32_t iround32(const double x) CT_NOEXCEPT
209209 {
210210 return CT_SIMPLE_ROUND32(x);
211211 }
@@ -216,7 +216,7 @@
216216 }
217217
218218 # 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
220220 {
221221 return CT_SIMPLE_ROUND64(x);
222222 }
diff -r 34e2659008ad -r 470e86c1363e tests/src/std/test_math.c
--- a/tests/src/std/test_math.c Sun Feb 26 01:22:14 2023 +0300
+++ b/tests/src/std/test_math.c Fri Mar 10 01:20:01 2023 +0300
@@ -56,35 +56,35 @@
5656
5757 void testCompileExtensionRound(void)
5858 {
59- TEST_ASSERT_EQUAL_INT8(roundf8(1.5f), 2);
59+ TEST_ASSERT_EQUAL_INT8(iroundf8(1.5f), 2);
6060 TEST_ASSERT_EQUAL_UINT8(uroundf8(1.5f), 2U);
6161
62- TEST_ASSERT_EQUAL_INT16(roundf16(1.5f), 2);
62+ TEST_ASSERT_EQUAL_INT16(iroundf16(1.5f), 2);
6363 TEST_ASSERT_EQUAL_UINT16(uroundf16(1.5f), 2U);
6464
65- TEST_ASSERT_EQUAL_INT32(roundf32(1.5f), 2);
65+ TEST_ASSERT_EQUAL_INT32(iroundf32(1.5f), 2);
6666 TEST_ASSERT_EQUAL_UINT32(uroundf32(1.5f), 2U);
6767
6868 #ifndef CT_NO_64
6969 # 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);
7171 TEST_ASSERT_EQUAL_UINT64(uroundf64(1.5f), 2U);
7272 # endif
7373 #endif
7474
7575
76- TEST_ASSERT_EQUAL_INT8(round8(1.5), 2);
76+ TEST_ASSERT_EQUAL_INT8(iround8(1.5), 2);
7777 TEST_ASSERT_EQUAL_UINT8(uround8(1.5), 2U);
7878
79- TEST_ASSERT_EQUAL_INT16(round16(1.5), 2);
79+ TEST_ASSERT_EQUAL_INT16(iround16(1.5), 2);
8080 TEST_ASSERT_EQUAL_UINT16(uround16(1.5), 2U);
8181
82- TEST_ASSERT_EQUAL_INT32(round32(1.5), 2);
82+ TEST_ASSERT_EQUAL_INT32(iround32(1.5), 2);
8383 TEST_ASSERT_EQUAL_UINT32(uround32(1.5), 2U);
8484
8585 #ifndef CT_NO_64
8686 # 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);
8888 TEST_ASSERT_EQUAL_UINT64(uround64(1.5), 2U);
8989 # endif
9090 #endif
Show on old repository browser