diff mbox

target-ppc/translate.c: Use ULL suffix for 64 bit constants

Message ID 1392925647-14649-1-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell Feb. 20, 2014, 7:47 p.m. UTC
64 bit constants need the "ULL" suffix, not just "UL", because
on 32 bit platforms 'long' is not large enough and this will
cause a compiler warning.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
I think plain "UL" as a suffix is pretty much never right;
it should either be "U" or "ULL".

 target-ppc/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefan Weil Feb. 20, 2014, 9:33 p.m. UTC | #1
Am 20.02.2014 20:47, schrieb Peter Maydell:
> 64 bit constants need the "ULL" suffix, not just "UL", because
> on 32 bit platforms 'long' is not large enough and this will
> cause a compiler warning.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I think plain "UL" as a suffix is pretty much never right;
> it should either be "U" or "ULL".
> 
>  target-ppc/translate.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/target-ppc/translate.c b/target-ppc/translate.c
> index c5c1108..54013a2 100644
> --- a/target-ppc/translate.c
> +++ b/target-ppc/translate.c
> @@ -7179,8 +7179,8 @@ static void gen_xxpermdi(DisasContext *ctx)
>  #define OP_NABS 2
>  #define OP_NEG 3
>  #define OP_CPSGN 4
> -#define SGN_MASK_DP  0x8000000000000000ul
> -#define SGN_MASK_SP 0x8000000080000000ul
> +#define SGN_MASK_DP  0x8000000000000000ull
> +#define SGN_MASK_SP 0x8000000080000000ull
>  
>  #define VSX_SCALAR_MOVE(name, op, sgn_mask)                       \
>  static void glue(gen_, name)(DisasContext * ctx)                  \
> 


Reviewed-by: Stefan Weil <sw@weilnetz.de>

(I personally prefer ULL instead of ull because it avoids constants
ending with 'full', and if we ignore the disas code, ULL is also more
common in QEMU)
Peter Maydell Feb. 20, 2014, 10:16 p.m. UTC | #2
On 20 February 2014 21:33, Stefan Weil <sw@weilnetz.de> wrote:
> (I personally prefer ULL instead of ull because it avoids constants
> ending with 'full', and if we ignore the disas code, ULL is also more
> common in QEMU)

I agree, as it happens, but I opted to stick with the existing case here.

thanks
-- PMM
Alexander Graf Feb. 21, 2014, 9:30 a.m. UTC | #3
On 20.02.2014, at 20:47, Peter Maydell <peter.maydell@linaro.org> wrote:

> 64 bit constants need the "ULL" suffix, not just "UL", because
> on 32 bit platforms 'long' is not large enough and this will
> cause a compiler warning.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Thanks, applied to ppc-next.


Alex
diff mbox

Patch

diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index c5c1108..54013a2 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -7179,8 +7179,8 @@  static void gen_xxpermdi(DisasContext *ctx)
 #define OP_NABS 2
 #define OP_NEG 3
 #define OP_CPSGN 4
-#define SGN_MASK_DP  0x8000000000000000ul
-#define SGN_MASK_SP 0x8000000080000000ul
+#define SGN_MASK_DP  0x8000000000000000ull
+#define SGN_MASK_SP 0x8000000080000000ull
 
 #define VSX_SCALAR_MOVE(name, op, sgn_mask)                       \
 static void glue(gen_, name)(DisasContext * ctx)                  \