mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
talk: Explicitly cast -1 as unsigned before a left shift.
The code is explcitly relying on twos complement numerical represntation so this just shuts up the compiler and static analysis warnings. Change-Id: If11cd0a3a4127e8a872a752119d347ac6e09424c
This commit is contained in:
parent
09fc9ee9a3
commit
df37450f91
1 changed files with 2 additions and 2 deletions
|
@ -70,13 +70,13 @@ enum talk_status {
|
||||||
|
|
||||||
/* make a "talkable" ID from number + unit
|
/* make a "talkable" ID from number + unit
|
||||||
unit is upper 4 bits, number the remaining (in regular 2's complement) */
|
unit is upper 4 bits, number the remaining (in regular 2's complement) */
|
||||||
#define TALK_ID(n,u) (((long)(u))<<UNIT_SHIFT | ((n) & ~(-1L<<DECIMAL_SHIFT)))
|
#define TALK_ID(n,u) (((long)(u))<<UNIT_SHIFT | ((n) & ~(((unsigned int)-1L)<<DECIMAL_SHIFT)))
|
||||||
|
|
||||||
/* make a "talkable" ID from a decimal number + unit, the decimal number
|
/* make a "talkable" ID from a decimal number + unit, the decimal number
|
||||||
is represented like x*10^d where d is the number of decimal digits */
|
is represented like x*10^d where d is the number of decimal digits */
|
||||||
#define TALK_ID_DECIMAL(n,d,u) (((long)(u))<<UNIT_SHIFT |\
|
#define TALK_ID_DECIMAL(n,d,u) (((long)(u))<<UNIT_SHIFT |\
|
||||||
((long)(d))<<DECIMAL_SHIFT |\
|
((long)(d))<<DECIMAL_SHIFT |\
|
||||||
((n) & ~(-1L<<DECIMAL_SHIFT)))
|
((n) & ~(((unsigned int)-1L)<<DECIMAL_SHIFT)))
|
||||||
|
|
||||||
/* convenience macro to have both virtual pointer and ID as arguments */
|
/* convenience macro to have both virtual pointer and ID as arguments */
|
||||||
#define STR(id) ID2P(id), id
|
#define STR(id) ID2P(id), id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue