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:
Solomon Peachy 2021-07-19 16:02:02 -04:00
parent 09fc9ee9a3
commit df37450f91
1 changed files with 2 additions and 2 deletions

View File

@ -70,13 +70,13 @@ enum talk_status {
/* make a "talkable" ID from number + unit
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
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 |\
((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 */
#define STR(id) ID2P(id), id