Micro-optimization

This commit is contained in:
Frank Denis 2015-06-22 15:56:35 +02:00
parent e2fca8cac5
commit 3822caf6c7

View File

@ -515,11 +515,11 @@ void
sodium_increment(unsigned char *n, const size_t nlen) sodium_increment(unsigned char *n, const size_t nlen)
{ {
size_t i; size_t i;
unsigned int c = 1U; unsigned int c = 1U << 8;
for (i = (size_t) 0U; i < nlen; i++) { for (i = (size_t) 0U; i < nlen; i++) {
c >>= 8;
c += n[i]; c += n[i];
n[i] = (unsigned char) c; n[i] = (unsigned char) c;
c >>= 8;
} }
} }