Add missing cast to uint32_t in hw_divider_u32_quotient for host #436

Merged
jonathangjertsen merged 1 commit from host-divider-add-missing-cast into develop 2021-05-23 08:21:09 -05:00
jonathangjertsen commented 2021-05-23 08:15:08 -05:00 (Migrated from github.com)

Fixes the following warning:

[...]/pico-sdk/src/host/hardware_divider/include/hardware/divider.h:81:26: warning: operand of ?: changes signedness from 'int' to 'uint32_t' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
     return b ? (a / b) : -1;
                          ^~

The fix is to make the cast explicit, like hw_divider_divmod_u32 already does

Fixes the following warning: ``` [...]/pico-sdk/src/host/hardware_divider/include/hardware/divider.h:81:26: warning: operand of ?: changes signedness from 'int' to 'uint32_t' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare] return b ? (a / b) : -1; ^~ ``` The fix is to make the cast explicit, like `hw_divider_divmod_u32` already does
kilograham (Migrated from github.com) reviewed 2021-05-23 08:20:55 -05:00
@ -80,3 +80,3 @@
static inline uint32_t hw_divider_u32_quotient(uint32_t a, uint32_t b) {
return b ? (a / b) : -1;
return b ? (a / b) : (uint32_t)(-1);
}
kilograham (Migrated from github.com) commented 2021-05-23 08:20:55 -05:00

going to merge anyway, but stylistically I would do (uint32_t)-1

going to merge anyway, but stylistically I would do `(uint32_t)-1`
kilograham (Migrated from github.com) approved these changes 2021-05-23 08:21:03 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk!436
No description provided.