Skip to content

Commit

Permalink
loperator: Use __builtin_parityll() instead of `__builtin_popcountl…
Browse files Browse the repository at this point in the history
…l()`
  • Loading branch information
krivenko committed Jun 20, 2024
1 parent d7d5990 commit 9cf8551
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/libcommute/loperator/monomial_action_fermion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ template <> class monomial_action<fermion> {
// Compute parity of the number of set bits in i
inline static bool parity_popcount(sv_index_type i) {
#if defined(__GNUC__) || defined(__clang__)
return __builtin_popcountll(i) & 0x01;
return __builtin_parityll(i);
#else
i ^= i >> 32;
i ^= i >> 16;
i ^= i >> 8;
i ^= i >> 4;
i ^= i >> 2;
i ^= i >> 1;
return i & 0x01;
return i & 0x1;
#endif
}

Expand Down

0 comments on commit 9cf8551

Please sign in to comment.