para qué se utiliza has_zero y find_zero en word_at_a_time.h
En Linux kernel, inlucde / linux / word_at_a_time.h, hay dos funciones:
static inline long find_zero(unsigned long mask)
{
long byte = 0;
#ifdef CONFIG_64BIT
if (mask >> 32)
mask >>= 32;
else
byte = 4;
#endif
if (mask >> 16)
mask >>= 16;
else
byte += 2;
return (mask >> 8) ? byte : byte + 1;
}
static inline bool has_zero(unsigned long val,
unsigned long *data,
const struct word_at_a_time *c)
{
unsigned long rhs = val | c->low_bits;
*data = rhs;
return (val + c->high_bits) & ~rhs;
}
Se usa en una función hash, en el registro de git dice:
- has_zero(): take a word, and determine if it has a zero byte in it.
It gets the word, the pointer to the constant pool, and a pointer to
an intermediate "data" field it can set.
Pero todavía no entiendo
(1) ¿Qué hace esta función, y
(2) ¿Cómo lo hacen?