Avoid negations on unsigned values

This commit is contained in:
Frank Denis 2017-09-21 11:23:37 +02:00
parent 7e06a6a991
commit 4ce2856a5d

View File

@ -682,7 +682,7 @@ sodium_unpad(size_t *unpadded_buflen_p, const unsigned char *buf,
is_barrier =
(( (acc - 1U) & (pad_len - 1U) & ((c ^ 0x80) - 1U) ) >> 8) & 1U;
acc |= c;
pad_len |= (i & - is_barrier);
pad_len |= i & (1U + ~is_barrier);
valid |= (unsigned char) is_barrier;
}
*unpadded_buflen_p = padded_buflen - 1U - pad_len;