someone said
[ghsmtp.git] / Pill.hpp
blob8c87365aebe4c1a58d4f406b1a7f9bcc0c88d749
1 #ifndef PILL_DOT_HPP
2 #define PILL_DOT_HPP
4 #include <climits>
5 #include <cstddef>
6 #include <ostream>
8 // A pill is a unit of entropy.
10 class Pill {
11 public:
12 Pill();
14 bool operator==(Pill const& that) const { return this->s_ == that.s_; }
15 bool operator!=(Pill const& that) const { return !(*this == that); }
17 private:
18 unsigned long long s_;
20 auto static constexpr b32_ndigits_ = ((sizeof(s_) * CHAR_BIT) + 4) / 5;
21 char b32_str_[b32_ndigits_ + 1];
23 friend std::ostream& operator<<(std::ostream& s, Pill const& p)
25 return s << p.b32_str_;
29 #endif // PILL_DOT_HPP