add precompiler guards to restrict builtin use to gcc and clang

This commit is contained in:
Francisco 2021-04-19 10:44:30 +01:00 committed by Francisco Paisana
parent 8ed8b94ca5
commit ac375f07d9
1 changed files with 4 additions and 0 deletions

View File

@ -89,6 +89,7 @@ struct zerobit_counter {
}
};
#ifdef __GNUC__ // clang and gcc
/// Specializations for unsigned
template <typename Integer>
struct zerobit_counter<Integer, sizeof(unsigned)> {
@ -101,7 +102,9 @@ struct zerobit_counter<Integer, sizeof(unsigned)> {
return (value) ? __builtin_ctz(value) : std::numeric_limits<Integer>::digits;
}
};
#endif
#ifdef __GNUC__ // clang and gcc
/// Specializations for unsigned long
template <typename Integer>
struct zerobit_counter<Integer, sizeof(unsigned long)> {
@ -114,6 +117,7 @@ struct zerobit_counter<Integer, sizeof(unsigned long)> {
return (value) ? __builtin_ctzl(value) : std::numeric_limits<Integer>::digits;
}
};
#endif
} // namespace detail