refractor to remove duplicate code between ASSERT_HEX and ASSERT_INT

use static inline min_of and max_of instead of macro
This commit is contained in:
hathach
2013-01-14 00:41:23 +07:00
parent f991475183
commit 3d8babcb14
3 changed files with 43 additions and 25 deletions

View File

@@ -73,10 +73,18 @@
#include "core/std_descriptors.h"
/// min value
#define MIN_(x, y) (((x) < (y)) ? (x) : (y))
static inline uint32_t min_of(uint32_t x, uint32_t y) ATTR_ALWAYS_INLINE;
static inline uint32_t min_of(uint32_t x, uint32_t y)
{
return (x < y) ? x : y;
}
/// max value
#define MAX_(x, y) (((x) > (y)) ? (x) : (y))
static inline uint32_t max_of(uint32_t x, uint32_t y) ATTR_ALWAYS_INLINE;
static inline uint32_t max_of(uint32_t x, uint32_t y)
{
return (x > y) ? x : y;
}
#ifdef __cplusplus
}