]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target-ppc: fix index array of national digits
authorJose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
Mon, 21 Nov 2016 14:55:13 +0000 (12:55 -0200)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 23 Nov 2016 01:00:48 +0000 (12:00 +1100)
Fixes the big endian array access of national digits, from commits
b815587 and e2106d7.

Signed-off-by: Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
target-ppc/int_helper.c

index 9ac204a393cf9c374a999240a9520c1b8bcdc9fc..2d57c9a1c22d613bf877f38283834d8e779c3a2f 100644 (file)
@@ -2572,7 +2572,7 @@ static int bcd_cmp_zero(ppc_avr_t *bcd)
 static uint16_t get_national_digit(ppc_avr_t *reg, int n)
 {
 #if defined(HOST_WORDS_BIGENDIAN)
-    return reg->u16[8 - n];
+    return reg->u16[7 - n];
 #else
     return reg->u16[n];
 #endif
@@ -2581,7 +2581,7 @@ static uint16_t get_national_digit(ppc_avr_t *reg, int n)
 static void set_national_digit(ppc_avr_t *reg, uint8_t val, int n)
 {
 #if defined(HOST_WORDS_BIGENDIAN)
-    reg->u16[8 - n] = val;
+    reg->u16[7 - n] = val;
 #else
     reg->u16[n] = val;
 #endif