OSDN Git Service

hw/ide/ahci.c: Fix shift left into sign bit
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 16 Oct 2015 16:19:35 +0000 (17:19 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Sun, 18 Oct 2015 10:00:40 +0000 (11:00 +0100)
commit40fe17bea478793fc9106a630fa3610dad51f939
treef5d8aeaff4836df6fcb3528f866bf25608d83eba
parentc737c7a608f4cd2c06e6600303845c4b469822c5
hw/ide/ahci.c: Fix shift left into sign bit

Avoid undefined behaviour from shifting left into the sign bit:

hw/ide/ahci.c:551:36: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'

(Unfortunately C's promotion rules mean that in the expression
"some_uint8_t_variable << 24" the LHS gets promoted to signed
int before shifting.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
hw/ide/ahci.c