mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Avoid conditions inside loop
This commit is contained in:
parent
3e6492f305
commit
d3cb224eb3
@ -160,15 +160,16 @@ fnv_32_buf(void *buf, size_t len, uint32_t hval, int alternate)
|
|||||||
/*
|
/*
|
||||||
* FNV-1 hash each octet in the buffer
|
* FNV-1 hash each octet in the buffer
|
||||||
*/
|
*/
|
||||||
while (bp < be) {
|
if (alternate == 0) {
|
||||||
|
while (bp < be) {
|
||||||
if (alternate == 0) {
|
|
||||||
/* multiply by the 32 bit FNV magic prime mod 2^32 */
|
/* multiply by the 32 bit FNV magic prime mod 2^32 */
|
||||||
hval *= PHP_FNV_32_PRIME;
|
hval *= PHP_FNV_32_PRIME;
|
||||||
|
|
||||||
/* xor the bottom with the current octet */
|
/* xor the bottom with the current octet */
|
||||||
hval ^= (uint32_t)*bp++;
|
hval ^= (uint32_t)*bp++;
|
||||||
} else {
|
}
|
||||||
|
} else {
|
||||||
|
while (bp < be) {
|
||||||
/* xor the bottom with the current octet */
|
/* xor the bottom with the current octet */
|
||||||
hval ^= (uint32_t)*bp++;
|
hval ^= (uint32_t)*bp++;
|
||||||
|
|
||||||
@ -202,15 +203,17 @@ fnv_64_buf(void *buf, size_t len, uint64_t hval, int alternate)
|
|||||||
/*
|
/*
|
||||||
* FNV-1 hash each octet of the buffer
|
* FNV-1 hash each octet of the buffer
|
||||||
*/
|
*/
|
||||||
while (bp < be) {
|
|
||||||
|
|
||||||
if (alternate == 0) {
|
if (alternate == 0) {
|
||||||
|
while (bp < be) {
|
||||||
/* multiply by the 64 bit FNV magic prime mod 2^64 */
|
/* multiply by the 64 bit FNV magic prime mod 2^64 */
|
||||||
hval *= PHP_FNV_64_PRIME;
|
hval *= PHP_FNV_64_PRIME;
|
||||||
|
|
||||||
/* xor the bottom with the current octet */
|
/* xor the bottom with the current octet */
|
||||||
hval ^= (uint64_t)*bp++;
|
hval ^= (uint64_t)*bp++;
|
||||||
} else {
|
}
|
||||||
|
} else {
|
||||||
|
while (bp < be) {
|
||||||
/* xor the bottom with the current octet */
|
/* xor the bottom with the current octet */
|
||||||
hval ^= (uint64_t)*bp++;
|
hval ^= (uint64_t)*bp++;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user