This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 3/3] lib: Avoid the hash-lookup division if possible


Josh Stone <jistone@redhat.com> writes:

> -  /* First hash function: simply take the modul but prevent zero.  */
> -  size_t idx = 1 + hval % htab->size;
> +  /* First hash function: simply take the modul but prevent zero.  Small values
> +   * can skip the division, which helps performance when this is common.  */
> +  size_t idx = 1 + (hval < htab->size ? hval : hval % htab->size);

Again the continuation *.  Otherwise this is fine, feel free to commit
after correcting this nit.

Thanks,
PM

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]