Skip to contentSkip to conversation

target-ppc: fix index array of national digits

PATCH Applied Jose Ricardo Ziviani 3 participants 3 messages Nov 21, 2016 – Nov 22, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-ppc: fix index array of national digits

Fixes the big endian array access of national digits, from commits b815587 and e2106d7.

---
 target-ppc/int_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target-ppc/int_helper.c +2 -2
index 9ac204a..2d57c9a 100644
@@ -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
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Jose Ricardo Ziviani

Fixes the big endian array access of national digits, from commits b815587 and e2106d7.

---
 target-ppc/int_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target-ppc/int_helper.c +1 -1
index 9ac204a..2d57c9a 100644
@@ -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

target-ppc/int_helper.c static uint16_t get_national_digit(ppc_avr_t *reg, int n) · line 2587

Quoted 8 lines
target-ppc/int_helper.c +1 -1
@@ -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
Applied
#2 lore raw
In reply to Jose Ricardo Ziviani
Quoted 4 lines · Jose Ricardo Ziviani

Fixes the big endian array access of national digits, from commits b815587 and e2106d7.

Applied to ppc-for-2.8, thanks.

Quoted 26 lines
---
 target-ppc/int_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
target-ppc/int_helper.c +2 -2
index 9ac204a..2d57c9a 100644
@@ -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
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson