diff options
| author | hathach <[email protected]> | 2013-01-14 00:41:23 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-01-14 00:41:23 +0700 |
| commit | 3d8babcb147022a6bced9b61455b301e3ea95150 (patch) | |
| tree | d1b55e5ed49d81d6220d1b77219f047b9bcd23fb /tinyusb/common/common.h | |
| parent | f9914751833deb1b135568b7c09271261f356a06 (diff) | |
refractor to remove duplicate code between ASSERT_HEX and ASSERT_INT
use static inline min_of and max_of instead of macro
Diffstat (limited to 'tinyusb/common/common.h')
| -rw-r--r-- | tinyusb/common/common.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h index 921de01bc..7d003d57b 100644 --- a/tinyusb/common/common.h +++ b/tinyusb/common/common.h @@ -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 } |
