static int inithash(kvm_t *kd, uint64_t *base, int len, off_t off) { uint64_t idx; uint64_t bit, bits; vm_paddr_t pa; for (idx = 0; idx < len / sizeof(*base); idx++) { bits = base[idx]; while (bits) { bit = bsfq(bits); bits &= ~(1ul << bit); pa = (idx * sizeof(*base) * NBBY + bit) * PAGE_SIZE; hpt_insert(kd, pa, off); off += PAGE_SIZE; } } return (off); }
static inline int find_mask_bsf(const uint64_t *mask, int size) { for (int i = 0; i < size; i++) if (mask[i]) return i * 64 + bsfq(mask[i]); return -1; }