diff mbox

target-ppc: fix index array of national digits

Message ID 1479740113-26834-1-git-send-email-joserz@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jose Ricardo Ziviani Nov. 21, 2016, 2:55 p.m. UTC
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>
---
 target-ppc/int_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thomas Huth Nov. 21, 2016, 3:05 p.m. UTC | #1
On 21.11.2016 15:55, Jose Ricardo Ziviani wrote:
> 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>
> ---
>  target-ppc/int_helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c
> index 9ac204a..2d57c9a 100644
> --- a/target-ppc/int_helper.c
> +++ b/target-ppc/int_helper.c
> @@ -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
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>
David Gibson Nov. 21, 2016, 11:03 p.m. UTC | #2
On Mon, Nov 21, 2016 at 12:55:13PM -0200, Jose Ricardo Ziviani wrote:
> 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>

Applied to ppc-for-2.8, thanks.

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

Patch

diff --git a/target-ppc/int_helper.c b/target-ppc/int_helper.c
index 9ac204a..2d57c9a 100644
--- a/target-ppc/int_helper.c
+++ b/target-ppc/int_helper.c
@@ -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