在 7/14/21 9:02 PM, Martin Storsjö 写道:
+unsigned char _bittestandset(__LONG32 *__a, __LONG32 __b)
+{
+unsigned char __v = (*__a >> __b) & 1;
+*__a |= (1 << __b);
I suggest `1UL` here, as shifting 1 to the left by 31 is undefined behavior.
+unsigned char _bittestandreset(__LONG32 *__a, __LONG32 __b)
+{
+unsigned char __v = (*__a >> __b) & 1;
+*__a &= ~(1 << __b);
Likewise.
+unsigned char _bittestandcomplement(__LONG32 *__a, __LONG32 __b)
+{
+unsigned char __v = (*__a >> __b) & 1;
+*__a = (*__a & ~(1 << __b)) | ((__v ^ 1) << __b);
Likewise.
+unsigned char _bittestandset64(__int64 *__a, __int64 __b)
+{
+unsigned char __v = (*__a >> __b) & 1;
+*__a |= (1LL << __b);
Likewise, but `1ULL`, and more follow.
--
Best regards,
LIU Hao
OpenPGP_signature
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public