r191783 - Fixing implementation of bittestandset in Intrin.h.

Warren Hunt whunt at google.com
Tue Oct 1 10:12:40 PDT 2013


Author: whunt
Date: Tue Oct  1 12:12:40 2013
New Revision: 191783

URL: http://llvm.org/viewvc/llvm-project?rev=191783&view=rev
Log:
Fixing implementation of bittestandset in Intrin.h.


Modified:
    cfe/trunk/lib/Headers/Intrin.h

Modified: cfe/trunk/lib/Headers/Intrin.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/Intrin.h?rev=191783&r1=191782&r2=191783&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/Intrin.h (original)
+++ cfe/trunk/lib/Headers/Intrin.h Tue Oct  1 12:12:40 2013
@@ -497,7 +497,7 @@ _bittestandreset(long *a, long b) {
 static __inline__ unsigned char __attribute__((__always_inline__, __nodebug__))
 _bittestandset(long *a, long b) {
   unsigned char x = (*a >> b) & 1;
-  *a = *a & (1 << b);
+  *a = *a | (1 << b);
   return x;
 }
 #ifdef __x86_64__
@@ -546,7 +546,7 @@ _bittestandreset64(__int64 *a, __int64 b
 static __inline__ unsigned char __attribute__((__always_inline__, __nodebug__))
 _bittestandset64(__int64 *a, __int64 b) {
   unsigned char x = (*a >> b) & 1;
-  *a = *a & (1ll << b);
+  *a = *a | (1ll << b);
   return x;
 }
 #endif





More information about the cfe-commits mailing list