Remove some type conversion warnings (using GCC pedantic warnings)

This commit is contained in:
Nathan Conrad 2019-09-09 13:35:41 -04:00
parent 4517d504b8
commit 75a3f791e3
2 changed files with 3 additions and 3 deletions

View File

@ -117,7 +117,7 @@ static inline uint32_t tu_align4k (uint32_t value) { return (value & 0xFFFFF000U
static inline uint32_t tu_offset4k(uint32_t value) { return (value & 0xFFFUL); }
//------------- Mathematics -------------//
static inline uint32_t tu_abs(int32_t value) { return (value < 0) ? (-value) : value; }
static inline uint32_t tu_abs(int32_t value) { return (uint32_t)((value < 0) ? (-value) : value); }
/// inclusive range checking
static inline bool tu_within(uint32_t lower, uint32_t value, uint32_t upper)

View File

@ -442,12 +442,12 @@ static inline tusb_dir_t tu_edpt_dir(uint8_t addr)
// Get Endpoint number from address
static inline uint8_t tu_edpt_number(uint8_t addr)
{
return addr & (~TUSB_DIR_IN_MASK);
return (uint8_t)(addr & (~TUSB_DIR_IN_MASK));
}
static inline uint8_t tu_edpt_addr(uint8_t num, uint8_t dir)
{
return num | (dir ? TUSB_DIR_IN_MASK : 0);
return (uint8_t)(num | (dir ? TUSB_DIR_IN_MASK : 0));
}
//--------------------------------------------------------------------+