mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-21 07:26:29 -05:00
Updates with latest tommyds library.
This commit is contained in:
parent
eeea58b42a
commit
d84babb6bd
16 changed files with 189 additions and 118 deletions
|
|
@ -92,22 +92,14 @@ void tommy_array_grow(tommy_array* array, unsigned size);
|
|||
*/
|
||||
tommy_inline void** tommy_array_ref(tommy_array* array, unsigned pos)
|
||||
{
|
||||
unsigned bsr;
|
||||
unsigned bsr;
|
||||
|
||||
assert(pos < array->size);
|
||||
|
||||
/* special case for the first bucket */
|
||||
if (pos < (1 << TOMMY_ARRAY_BIT)) {
|
||||
return &array->bucket[0][pos];
|
||||
}
|
||||
/* get the highest bit set, in case of all 0, return 0 */
|
||||
bsr = tommy_ilog2_u32(pos | 1);
|
||||
|
||||
/* get the highest bit set */
|
||||
bsr = tommy_ilog2_u32(pos);
|
||||
|
||||
/* clear the highest bit */
|
||||
pos -= 1 << bsr;
|
||||
|
||||
return &array->bucket[bsr - TOMMY_ARRAY_BIT + 1][pos];
|
||||
return &array->bucket[bsr][pos];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue