mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #18849 from benpicco/core-SIGNOF
core/macros: fix SIGNOF() macro when applied to size_t
This commit is contained in:
commit
e402e3f57a
@ -31,7 +31,7 @@ extern "C" {
|
||||
unsigned int: 1, \
|
||||
unsigned long: 1, \
|
||||
unsigned long long: 1, \
|
||||
default: (long long)(a) < 0 ? -1 : 1)
|
||||
default: ((a) <= 0 ? ((a) == 0 ? 1L : -1L ): 1L))
|
||||
/**
|
||||
* @brief Calculates @p a/ @p b with arithmetic rounding
|
||||
*/
|
||||
|
@ -22,7 +22,9 @@ static void test_math_signof(void)
|
||||
|
||||
static void test_math_div_round(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_INT(3, DIV_ROUND(20, 7));
|
||||
size_t a = 20;
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(3, DIV_ROUND(a, 7));
|
||||
TEST_ASSERT_EQUAL_INT(3, DIV_ROUND(21, 7));
|
||||
TEST_ASSERT_EQUAL_INT(3, DIV_ROUND(22, 7));
|
||||
TEST_ASSERT_EQUAL_INT(0, DIV_ROUND(1, UINT32_MAX));
|
||||
|
Loading…
Reference in New Issue
Block a user