target-ppc: fix index array of national digits

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>
This commit is contained in:
Jose Ricardo Ziviani 2016-11-21 12:55:13 -02:00 committed by David Gibson
parent 8a273cbe53
commit a813fe7362

View 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) static uint16_t get_national_digit(ppc_avr_t *reg, int n)
{ {
#if defined(HOST_WORDS_BIGENDIAN) #if defined(HOST_WORDS_BIGENDIAN)
return reg->u16[8 - n]; return reg->u16[7 - n];
#else #else
return reg->u16[n]; return reg->u16[n];
#endif #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) static void set_national_digit(ppc_avr_t *reg, uint8_t val, int n)
{ {
#if defined(HOST_WORDS_BIGENDIAN) #if defined(HOST_WORDS_BIGENDIAN)
reg->u16[8 - n] = val; reg->u16[7 - n] = val;
#else #else
reg->u16[n] = val; reg->u16[n] = val;
#endif #endif