[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gc-pbkdf2-sha1
From: |
Simon Josefsson |
Subject: |
Re: gc-pbkdf2-sha1 |
Date: |
Wed, 12 Oct 2005 17:51:11 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
Bruno Haible <address@hidden> writes:
> Simon Josefsson wrote:
>
>> + l = dkLen / hLen;
>> + if (dkLen % hLen)
>> + l++;
>
> An equivalent but faster code is:
>
> l = ((dkLen - 1) / hLen) + 1;
Perhaps for clarity we could change it into:
#define CEIL_DIV(a,b) (((a) - 1) / (b)) + 1
l = CEIL_DIV (dkLen, hLen);
What do you think?
Neither of the first two approaches is really trivial to understand
what they mean, and a mnemonic like "CEIL_DIV" might improve
readability.
Thanks!