diff options
author | JINMEI Tatuya <jinmei@isc.org> | 2013-03-06 23:21:49 +0100 |
---|---|---|
committer | JINMEI Tatuya <jinmei@isc.org> | 2013-03-06 23:21:49 +0100 |
commit | b48b9c7e0d0b51d399f248cb3387dbae770d157e (patch) | |
tree | cc04bbadc80371023443893fa18bb002be17a1cc /src/lib/util/encode | |
parent | [2764] unified exception messages for the two incomplete-input cases. (diff) | |
download | kea-b48b9c7e0d0b51d399f248cb3387dbae770d157e.tar.xz kea-b48b9c7e0d0b51d399f248cb3387dbae770d157e.zip |
[2764] use x % 8 instead of x & 7 to check x is a multiple of 8
assuming the compiler optimizes the former (more understandable but
possibly less efficient) to the latter (less understandable but
efficient).
Diffstat (limited to 'src/lib/util/encode')
-rw-r--r-- | src/lib/util/encode/base_n.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/util/encode/base_n.cc b/src/lib/util/encode/base_n.cc index f37ebfc3e6..461ca0a68d 100644 --- a/src/lib/util/encode/base_n.cc +++ b/src/lib/util/encode/base_n.cc @@ -378,7 +378,7 @@ BaseNTransformer<BitsPerChunk, BaseZeroCode, Encoder, Decoder>::decode( // Number of bits of the conversion result including padding must be // a multiple of 8; otherwise the decoder reaches the end of input // with some incomplete bits of data, which is invalid. - if (((char_count * BitsPerChunk) & 7) != 0) { + if (((char_count * BitsPerChunk) % 8) != 0) { throw IncompleteBaseInput(); // catch this immediately below } } catch (const IncompleteBaseInput&) { |