Commit b48b9c7e authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[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).
parent dd41cb13
......@@ -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&) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment