On Sun, 18 Jul 2021, LIU Hao wrote:
在 2021-07-15 05:16, Martin Storsjö 写道:
+#if __INTRINSIC_PROLOG(_bittestandcomplement)
+unsigned char _bittestandcomplement(__LONG32 *a, __LONG32 b);
+#if !__has_builtin(_bittestandcomplement)
+__INTRINSICS_USEINLINE
+unsigned char _bittestandcomplement(__LONG32 *__a, __LONG32 __b)
+{
+ unsigned char __v = (*__a >> __b) & 1;
+ *__a = (*__a & ~(1UL << __b)) | ((__v ^ 1) << __b);
Could this be simplified to `*__a ^= 1UL << __b`, like other bitwise AND
and OR operations?
Doh, right, that should work yes.
// Martin
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public