IMPORT: ebtree: switch the sizes and offsets to size_t and ssize_t

Let's use these in order to avoid 32-64 bit casts on 64 bit platforms.

This is cbtree commit e4f4c10fcb5719b626a1ed4f8e4e94d175468c34.
This is ebtree commit cc10507385c784d9a9e74ea9595493317d3da99e.
This commit is contained in:
Willy Tarreau 2023-12-17 17:24:01 +01:00
parent 9afe3b59a7
commit fc421e5b3d
1 changed files with 8 additions and 8 deletions

View File

@ -729,9 +729,9 @@ static forceinline void __eb_delete(struct eb_node *node)
* bytes. Note that parts or all of <ignore> bits may be rechecked. It is only * bytes. Note that parts or all of <ignore> bits may be rechecked. It is only
* passed here as a hint to speed up the check. * passed here as a hint to speed up the check.
*/ */
static forceinline int equal_bits(const unsigned char *a, static forceinline size_t equal_bits(const unsigned char *a,
const unsigned char *b, const unsigned char *b,
int ignore, int len) size_t ignore, size_t len)
{ {
for (ignore >>= 3, a += ignore, b += ignore, ignore <<= 3; for (ignore >>= 3, a += ignore, b += ignore, ignore <<= 3;
ignore < len; ) { ignore < len; ) {
@ -747,7 +747,7 @@ static forceinline int equal_bits(const unsigned char *a,
* it as the number of identical bits. Note that low bit numbers are * it as the number of identical bits. Note that low bit numbers are
* assigned to high positions in the byte, as we compare them as strings. * assigned to high positions in the byte, as we compare them as strings.
*/ */
ignore -= flsnz8(c); ignore -= flsnz_long(c);
break; break;
} }
} }
@ -795,12 +795,12 @@ static forceinline int check_bits(const unsigned char *a,
* permitted. Equal strings are reported as a negative number of bits, which * permitted. Equal strings are reported as a negative number of bits, which
* indicates the end was reached. * indicates the end was reached.
*/ */
static forceinline int string_equal_bits(const unsigned char *a, static forceinline ssize_t string_equal_bits(const unsigned char *a,
const unsigned char *b, const unsigned char *b,
int ignore) size_t ignore)
{ {
int beg;
unsigned long c, d; unsigned long c, d;
size_t beg;
beg = ignore >> 3; beg = ignore >> 3;