Open MaJerle opened 11 months ago
| | `-BinaryOperator <col:24, col:47> 'int' '>>'
| | |-ImplicitCastExpr <col:24> 'int' <IntegralCast>
| | | `-ImplicitCastExpr <col:24> 'uint16_t':'unsigned short' <LValueToRValue>
| | | `-DeclRefExpr <col:24> 'uint16_t':'unsigned short' lvalue ParmVar 0x564691aef6f0 'hex' 'uint16_t':'unsigned short'
| | `-ParenExpr <col:31, col:47> 'unsigned int'
| | `-BinaryOperator <col:32, col:46> 'unsigned int' '*'
| | |-IntegerLiteral <col:32> 'unsigned int' 4
| | `-ParenExpr <col:37, col:46> 'unsigned int'
| | `-BinaryOperator <col:38, col:44> 'unsigned int' '-'
| | |-ImplicitCastExpr <col:38> 'unsigned int' <IntegralCast>
| | | `-ImplicitCastExpr <col:38> 'uint8_t':'unsigned char' <LValueToRValue>
| | | `-DeclRefExpr <col:38> 'uint8_t':'unsigned char' lvalue Var 0x564691aef970 'idx' 'uint8_t':'unsigned char'
| | `-IntegerLiteral <col:44> 'unsigned int' 1
There is implicit cast to int because its uint32 vs uint16 and uint16 is casted to int.
is the warning expected and therefore not considered bug?
returns use of a signed integer operand with a biary bitwise operator and points to line
uint8_t aux = (hex >> (4U * (idx - 1U))) & 0x0FU;
Adding
(uint8_t)
cast infront, solves the issue.This is part of
hicpp-signed-bitwise
Version
17.0.5
Why? Doesn't tidy understand it is all unsigned already?