w32: Fix compilation and replace non-portable usage of ulong
PATCH 1/1 w32: Fix compilation and replace non-portable usage of ulong
ulong is undefined for w32 (and maybe other) compilations. Replace it by uintptr_t (which also fixes compilation for w64 and is a better choice for pointer to integer conversions).
Cc Aurelien Jarno <[email protected]>
Signed-off-by Stefan Weil <[email protected]>
--- target-ppc/cpu.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
target-ppc/cpu.h +2 -2
@@ -1929,8 +1929,8 @@ static inline void cpu_set_tls(CPUState *env, target_ulong newtls)#if !defined(CONFIG_USER_ONLY )static inline int booke206_tlbe_id (CPUState *env,ppcemb_tlb_t *tlbe) { -ulong tlbel = (ulong )tlbe; -ulong tlbl = (ulong )env->tlb; +uintptr_t tlbel = (uintptr_t )tlbe; +uintptr_t tlbl = (uintptr_t )env->tlb;return (tlbel - tlbl) /sizeof (env->tlb[0 ]); }
Signature · 1 line
1.5.6.5
Quoted 9 lines · Stefan Weil
ulong is undefined for w32 (and maybe other) compilations. Replace it by
uintptr_t(which also fixes compilation for w64 and is a better choice for pointer to integer conversions).Cc Aurelien Jarno <[email protected]>Signed-off-by Stefan Weil <[email protected]>--- target-ppc/cpu.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Reviewed-by Aurelien Jarno <[email protected]>
Quoted 19 lines
target-ppc/cpu.h +2
-2@@ -1929,8 +1929,8 @@ static inline void cpu_set_tls(CPUState *env, target_ulong newtls)#if !defined(CONFIG_USER_ONLY )static inline int booke206_tlbe_id (CPUState *env,ppcemb_tlb_t *tlbe) { -ulong tlbel = (ulong )tlbe; -ulong tlbl = (ulong )env->tlb; +uintptr_t tlbel = (uintptr_t )tlbe; +uintptr_t tlbl = (uintptr_t )env->tlb;return (tlbel - tlbl) /sizeof (env->tlb[0 ]); }Signature · 1 line
1.5.6.5
Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net
Andreas Färber
Acked-byAm 15.05.2011 um 12:36 schrieb Aurelien Jarno:
Quoted 2 lines · Stefan Weil
Quoted 1 line
ulong is undefined for w32 (and maybe other) compilations.
Darwin
Quoted 10 lines
Quoted 8 lines
Replace it by
uintptr_t(which also fixes compilation for w64 and is a better choice for pointer to integer conversions).Cc Aurelien Jarno <[email protected]>Signed-off-by Stefan Weil <[email protected]>---
target-ppc/cpu.h| 4 ++--1 files changed, 2 insertions(+), 2 deletions(-)Reviewed-by Aurelien Jarno <[email protected]>
Matches the patch I came up with for Mac OS X.
Acked-by Andreas Färber <[email protected]>
Quoted 25 lines
Quoted 20 lines
target-ppc/cpu.h +2
-2@@ -1929,8 +1929,8 @@ static inline void cpu_set_tls(CPUState *env, target_ulong newtls)#if !defined(CONFIG_USER_ONLY )static inline int booke206_tlbe_id (CPUState *env,ppcemb_tlb_t *tlbe) { -ulong tlbel = (ulong )tlbe; -ulong tlbl = (ulong )env->tlb; +uintptr_t tlbel = (uintptr_t )tlbe; +uintptr_t tlbl = (uintptr_t )env->tlb;return (tlbel - tlbl) /sizeof (env->tlb[0 ]);}
Signature · 1 line
1.5.6.5Signature · 2 lines
Aurelien Jarno GPG: 1024D/F1BCDB73 [email protected] http://www.aurel32.net