[Cbe-oss-dev] [PATCH] libspe2 use casts for spe_reg128toptr and spe_ptrto64

Patrick Mansfield patmans at us.ibm.com
Fri Jun 22 02:46:12 EST 2007


Use casts and get rid of the separate 32 and 64 bit functions for the
spe_reg128toptr and spe_ptrto64.

Signed-off-by: Patrick Mansfield <patmans at us.ibm.com>

Index: quilt-libspe2/spebase/default_posix1_handler.c
===================================================================
--- quilt-libspe2.orig/spebase/default_posix1_handler.c
+++ quilt-libspe2/spebase/default_posix1_handler.c
@@ -231,37 +231,20 @@ struct spe_compat_dirent {
         char d_name[256];
 };
 
-#ifdef __powerpc64__
 static inline void *spe_reg128toptr(struct spe_reg128 *reg)
 {
     addr64 a64;
 
     a64.by32[0] = reg->slot[0];
     a64.by32[1] = reg->slot[1];
-    return (void *) a64.all64;
+    return (void *) (unsigned long) a64.all64;
 }
 
 static inline uint64_t spe_ptrto64 (void *ptr)
 {
-    return (uint64_t) ptr;
+    return (uint64_t) (unsigned long) ptr;
 }
 
-#else
-static inline void *spe_reg128toptr(struct spe_reg128 *reg)
-{
-    return (void *) reg->slot[1];
-}
-
-static inline uint64_t spe_ptrto64 (void *ptr)
-{
-    addr64 a64;
-
-    a64.by32[0] = 0; /* never used */
-    a64.by32[1] = (unsigned int) ptr;
-    return a64.all64;
-}
-#endif
-
 static void spe_copy_dirent(struct spe_compat_dirent *spe_ent,
                             struct dirent *ent)
 {



More information about the cbe-oss-dev mailing list