about summary refs log tree commit diff
path: root/arch/powerpc/atomic.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-11-14 14:08:33 -0500
committerRich Felker <dalias@aerifal.cx>2012-11-14 14:08:33 -0500
commit574d01a69617921b72d0171f9a0d6cd414619220 (patch)
treecb50b670c39d4ec36e7cc9aaacaea55497dc3c42 /arch/powerpc/atomic.h
parent50cb6dbb0cd794aec06c6291ba55f369f9bbe142 (diff)
downloadmusl-574d01a69617921b72d0171f9a0d6cd414619220.tar.gz
musl-574d01a69617921b72d0171f9a0d6cd414619220.tar.xz
musl-574d01a69617921b72d0171f9a0d6cd414619220.zip
update ppc atomic code to match the endian-agnostic version on other archs
Diffstat (limited to 'arch/powerpc/atomic.h')
-rw-r--r--arch/powerpc/atomic.h20
1 files changed, 6 insertions, 14 deletions
diff --git a/arch/powerpc/atomic.h b/arch/powerpc/atomic.h
index af397599..a83764d9 100644
--- a/arch/powerpc/atomic.h
+++ b/arch/powerpc/atomic.h
@@ -101,24 +101,16 @@ static inline void a_or(volatile int *p, int v)
 
 static inline void a_and_64(volatile uint64_t *p, uint64_t v)
 {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-	a_and((int *)p, v);
-	a_and((int *)p+1, v>>32);
-#else
-	a_and((int *)p+1, v);
-	a_and((int *)p, v>>32);
-#endif
+	union { uint64_t v; uint32_t r[2]; } u = { v };
+	a_and((int *)p, u.r[0]);
+	a_and((int *)p+1, u.r[1]);
 }
 
 static inline void a_or_64(volatile uint64_t *p, uint64_t v)
 {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-	a_or((int *)p, v);
-	a_or((int *)p+1, v>>32);
-#else
-	a_or((int *)p+1, v);
-	a_or((int *)p, v>>32);
-#endif
+	union { uint64_t v; uint32_t r[2]; } u = { v };
+	a_or((int *)p, u.r[0]);
+	a_or((int *)p+1, u.r[1]);
 }
 
 #endif