[dpdk-dev] [PATCH v5 09/10] hash: rename rte_jhash2 to rte_jhash_32b
Bruce Richardson
bruce.richardson at intel.com
Wed Jun 10 13:09:45 CEST 2015
On Fri, May 22, 2015 at 11:16:10AM +0100, Pablo de Lara wrote:
> Changed name to something more meaningful,
> and mark rte_jhash2 as deprecated.
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch at intel.com>
> ---
> app/test/test_func_reentrancy.c | 2 +-
> app/test/test_hash.c | 4 ++--
> app/test/test_hash_functions.c | 6 +++---
> lib/librte_hash/rte_jhash.h | 17 +++++++++++++++--
> 4 files changed, 21 insertions(+), 8 deletions(-)
>
<snip>
> @@ -278,7 +280,7 @@ rte_jhash_2hashes(const void *key, uint32_t length, uint32_t *pc, uint32_t *pb)
> * IN: second seed OUT: secondary hash value.
> */
> static inline void
> -rte_jhash2_2hashes(const uint32_t *k, uint32_t length, uint32_t *pc, uint32_t *pb)
> +rte_jhash_32b_2hashes(const uint32_t *k, uint32_t length, uint32_t *pc, uint32_t *pb)
> {
> __rte_jhash_2hashes((const void *) k, (length << 2), pc, pb, 0);
> }
> @@ -321,11 +323,22 @@ rte_jhash(const void *key, uint32_t length, uint32_t initval)
> * Calculated hash value.
> */
> static inline uint32_t
> +rte_jhash_32b(const uint32_t *k, uint32_t length, uint32_t initval)
> +{
> + uint32_t initval2 = 0;
> +
> + rte_jhash_32b_2hashes(k, length, &initval, &initval2);
> +
> + return initval;
> +}
> +
> +static inline uint32_t
> rte_jhash2(const uint32_t *k, uint32_t length, uint32_t initval)
> {
> uint32_t initval2 = 0;
>
> - rte_jhash2_2hashes(k, length, &initval, &initval2);
> + RTE_LOG(WARNING, HASH, "rte_jhash2 is deprecated\n");
> + rte_jhash_32b_2hashes(k, length, &initval, &initval2);
>
> return initval;
> }
To deprecate this, rather than printing a message each time it is called, just
add "__attribute__((deprecated))" to the definition, and let the compiler do the
work of flagging this to the user.
/Bruce
More information about the dev
mailing list