Skip to content

Commit

Permalink
static_assert fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
aliireza authored and tbarbette committed May 7, 2020
1 parent 6989217 commit aaa8aeb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions include/click/tokenbucket64.hh
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ class TokenRate64X : public P { public:


~TokenRate64X() {
static_assert(sizeof(time_point_type) == sizeof(uint64_t));
static_assert(sizeof(token_type) == sizeof(uint64_t));
static_assert(sizeof(time_point_type) == sizeof(uint64_t), "time_point_type has the wrong size.");
static_assert(sizeof(token_type) == sizeof(uint64_t), "toke_type has the wrong size.");
}

/** @brief Set the token rate to idle or unlimited.
Expand Down Expand Up @@ -208,7 +208,7 @@ void TokenRate64X<P>::assign(bool unlimited)
template <typename P>
void TokenRate64X<P>::assign(token_type rate, token_type capacity)
{
static_assert(sizeof(token_type) == sizeof(uint64_t));
static_assert(sizeof(token_type) == sizeof(uint64_t), "token_type has the wrong size.");
if (capacity == 0) {
rate = 0;
capacity = tokens_overflow;
Expand Down Expand Up @@ -276,7 +276,7 @@ template<typename rate_type> struct TokenRate64Converter<rate_type, true> {
};
template<typename rate_type> struct TokenRate64Converter<rate_type, false> {
static bool cvt(const rate_type &rate, typename rate_type::token_type &t) {
static_assert(sizeof(rate_type) == sizeof(uint64_t));
static_assert(sizeof(rate_type) == sizeof(uint64_t), "rate_type has the wrong size.");
if (t <= rate.capacity()) {
return true;
} else {
Expand Down Expand Up @@ -339,9 +339,9 @@ class TokenCounter64X { public:
* The initial time point is 0. */
TokenCounter64X()
: _tokens(0), _time_point() {
static_assert(sizeof(ticks_type) == sizeof(uint64_t));
static_assert(sizeof(time_point_type) == sizeof(uint64_t));
static_assert(sizeof(token_type) == sizeof(uint64_t));
static_assert(sizeof(ticks_type) == sizeof(uint64_t), "tickes_type has the wrong size.");
static_assert(sizeof(time_point_type) == sizeof(uint64_t), "time_point_type has the wrong size.");
static_assert(sizeof(token_type) == sizeof(uint64_t), "token_type has the wrong size.");
}

/** @brief Return the number of tokens in the counter.
Expand Down Expand Up @@ -708,7 +708,7 @@ class TokenBucket64X { public:
}

~TokenBucket64X() {
static_assert(sizeof(token_type) == sizeof(uint64_t));
static_assert(sizeof(token_type) == sizeof(uint64_t), "token_type has the wrong size.");
}

/** @brief Set the token bucket rate to idle or unlimited.
Expand Down

0 comments on commit aaa8aeb

Please sign in to comment.