hashlib: Add a hash for bool.

This commit is contained in:
Marcelina Kościelnicka 2021-05-24 21:27:29 +02:00
parent 5488c69d2a
commit dbfd0b61e3
1 changed files with 6 additions and 0 deletions

View File

@ -66,6 +66,12 @@ struct hash_int_ops {
} }
}; };
template<> struct hash_ops<bool> : hash_int_ops
{
static inline unsigned int hash(bool a) {
return a ? 1 : 0;
}
};
template<> struct hash_ops<int32_t> : hash_int_ops template<> struct hash_ops<int32_t> : hash_int_ops
{ {
static inline unsigned int hash(int32_t a) { static inline unsigned int hash(int32_t a) {