[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/5] libihash: add hurd_ihash_value_valid
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 3/5] libihash: add hurd_ihash_value_valid |
Date: |
Wed, 21 May 2014 01:45:30 +0200 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Justus Winter, le Thu 15 May 2014 23:10:49 +0200, a écrit :
> * libihash/ihash.h (hurd_ihash_value_valid): New function.
> * libihash/ihash.c (index_empty): Use hurd_ihash_value_valid.
Ack.
> ---
> libihash/ihash.c | 3 +--
> libihash/ihash.h | 7 +++++++
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/libihash/ihash.c b/libihash/ihash.c
> index 4d9cc18..5b7b542 100644
> --- a/libihash/ihash.c
> +++ b/libihash/ihash.c
> @@ -50,8 +50,7 @@ murmur3_mix32 (uint32_t h, unsigned int bits)
> static inline int
> index_empty (hurd_ihash_t ht, unsigned int idx)
> {
> - return ht->items[idx].value == _HURD_IHASH_EMPTY
> - || ht->items[idx].value == _HURD_IHASH_DELETED;
> + return ! hurd_ihash_value_valid (ht->items[idx].value);
> }
>
>
> diff --git a/libihash/ihash.h b/libihash/ihash.h
> index 345630d..394bcf9 100644
> --- a/libihash/ihash.h
> +++ b/libihash/ihash.h
> @@ -41,6 +41,13 @@ typedef void *hurd_ihash_value_t;
> #define _HURD_IHASH_EMPTY ((hurd_ihash_value_t) 0)
> #define _HURD_IHASH_DELETED ((hurd_ihash_value_t) -1)
>
> +/* Test if VALUE is valid. */
> +static inline int
> +hurd_ihash_value_valid (hurd_ihash_value_t value)
> +{
> + return value != _HURD_IHASH_EMPTY && value != _HURD_IHASH_DELETED;
> +}
> +
> /* The type of integer we want to use for the keys. */
> typedef uintptr_t hurd_ihash_key_t;
>
> --
> 2.0.0.rc0
>
--
Samuel
There are two types of Linux developers - those who can spell, and
those who can't. There is a constant pitched battle between the two.
(From one of the post-1.1.54 kernel update messages posted to c.o.l.a)
- next round of patches, Justus Winter, 2014/05/15
- [PATCH 2/5] libihash: add hurd_ihash_get_load, Justus Winter, 2014/05/15
- [PATCH 5/5] include: add lock-less reference counting primitives, Justus Winter, 2014/05/15
- [PATCH 1/5] libihash: fix typo, Justus Winter, 2014/05/15
- [PATCH 3/5] libihash: add hurd_ihash_value_valid, Justus Winter, 2014/05/15
- Re: [PATCH 3/5] libihash: add hurd_ihash_value_valid,
Samuel Thibault <=
- [PATCH 4/5] libihash: optimize lookup-or-insert operations, Justus Winter, 2014/05/15