Skip to contentSkip to conversation

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

PATCH Applied Peter Maydell 3 participants 4 messages Feb 20, 2014 – Feb 21, 2014

lore
Share & tools
lore
#0 lore raw

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

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.

---
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(-)
target-ppc/translate.c +2 -2
index c5c1108..54013a2 100644
@@ -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)                  \
Signature · 1 line
1.8.5
Reviewed-by on v1 1/1
#1 lore raw

Am 20.02.2014 20:47, schrieb Peter Maydell:

Quoted 18 lines

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.

---
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(-)
target-ppc/translate.c +0 -0
index c5c1108..54013a2 100644

target-ppc/translate.c static void gen_xxpermdi(DisasContext *ctx) · line 7186

Quoted 10 lines
target-ppc/translate.c +2 -2
@@ -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)                  \

(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)

#2 lore raw
Quoted 3 lines · Stefan Weil

(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