Implement negation for 128bit Bitboard
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 22 May 2021 12:49:20 +0000 (14:49 +0200)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 22 May 2021 12:49:20 +0000 (14:49 +0200)
src/types.h

index 628e00c..4f4aee7 100644 (file)
@@ -183,6 +183,10 @@ struct Bitboard {
         return Bitboard(~b64[0], ~b64[1]);
     }
 
+    constexpr Bitboard operator - () const {
+        return Bitboard(-b64[0] - (b64[1] > 0), -b64[1]);
+    }
+
     constexpr Bitboard operator | (const Bitboard x) const {
         return Bitboard(b64[0] | x.b64[0], b64[1] | x.b64[1]);
     }