X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-hash-helper.h;h=36c3ae4274906ea96c26886bb81293fa405e9844;hb=6ba6fd60507f8e045bdc4f1be14e9d99c6a15f7f;hp=bddc7c46729228d39e75d22cc578b67cd6ea1f64;hpb=bf956ec0051ba7f365693e194bc0aeaf4343a82c;p=lttng-ust.git diff --git a/liblttng-ust/lttng-hash-helper.h b/liblttng-ust/lttng-hash-helper.h index bddc7c46..36c3ae42 100644 --- a/liblttng-ust/lttng-hash-helper.h +++ b/liblttng-ust/lttng-hash-helper.h @@ -1,29 +1,16 @@ -#ifndef _LTTNG_HASH_HELPER_H -#define _LTTNG_HASH_HELPER_H - /* - * lttng-hash-helper.h - * - * LTTng hash table helpers. + * SPDX-License-Identifier: LGPL-2.1-only * * Copyright (C) 2012 Mathieu Desnoyers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; only - * version 2.1 of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * LTTng hash table helpers. */ +#ifndef _LTTNG_HASH_HELPER_H +#define _LTTNG_HASH_HELPER_H + #include +#include #include #include @@ -56,7 +43,10 @@ do { \ c ^= b; c -= rot(b, 24); \ } -static inline __attribute__((unused)) +static inline +uint32_t lttng_hash_u32(const uint32_t *k, size_t length, uint32_t initval) + __attribute__((unused)); +static inline uint32_t lttng_hash_u32( const uint32_t *k, /* the key, an array of uint32_t values */ size_t length, /* the length of the key, in uint32_ts */ @@ -115,10 +105,10 @@ void lttng_hashword2( /*----------------------------------- handle the last 3 uint32_t's */ switch (length) { /* all the case statements fall through */ - case 3: c += k[2]; - case 2: b += k[1]; + case 3: c += k[2]; /* fall through */ + case 2: b += k[1]; /* fall through */ case 1: a += k[0]; - final(a, b, c); + final(a, b, c); /* fall through */ case 0: /* case 0: nothing left to add */ break; }