[riot-notifications] [RIOT] Bloom bytes (#176)

René Kijewski notifications at github.com
Sun Aug 25 20:06:21 CEST 2013


> + *
> + * found on
> + * http://burtleburtle.net/bob/hash/doobs.html
> + */
> +static uint32_t one_at_a_time_hash(const uint32_t *buf, int len)
> +{
> +    uint32_t hash = 786431; /* prime */
> +
> +    for(int i = 0; i < len; i++) {
> +        hash += buf[i];
> +        hash += (hash << 10);
> +        hash ^= (hash >> 6);
> +    }
> +    hash += (hash << 3);
> +    hash ^= (hash >> 11);
> +    hash += (hash << 15);

All the parens on the rhs aren't needed (here and in the loop).

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/176/files#r5969147
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20130825/6916a9bb/attachment.html>


More information about the notifications mailing list