return -1;
}
- idx = ptn->hashid & (_ps_ptable->ssize - 1);
+ idx = core_hash_idx(ptn->hashid, _ps_ptable->ssize);
lock_get(&_ps_ptable->slots[idx].lock);
if(_ps_ptable->slots[idx].plist == NULL) {
ptc.ruid = pres_sruid.uid;
}
- idx = ptc.hashid & (_ps_ptable->ssize - 1);
+ idx = core_hash_idx(ptc.hashid, _ps_ptable->ssize);
lock_get(&_ps_ptable->slots[idx].lock);
ptn = _ps_ptable->slots[idx].plist;
ptc.ruid = pres_sruid.uid;
}
- idx = ptc.hashid & (_ps_ptable->ssize - 1);
+ idx = core_hash_idx(ptc.hashid, _ps_ptable->ssize);
lock_get(&_ps_ptable->slots[idx].lock);
ptn = _ps_ptable->slots[idx].plist;
memcpy(&ptc, pt, sizeof(ps_presentity_t));
ptc.hashid = core_case_hash(&pt->user, &pt->domain, 0);
- idx = ptc.hashid & (_ps_ptable->ssize - 1);
+ idx = core_hash_idx(ptc.hashid, _ps_ptable->ssize);
lock_get(&_ps_ptable->slots[idx].lock);
ptn = _ps_ptable->slots[idx].plist;
ptc.user = *user;
ptc.domain = *domain;
ptc.hashid = core_case_hash(&ptc.user, &ptc.domain, 0);
- idx = ptc.hashid & (_ps_ptable->ssize - 1);
+ idx = core_hash_idx(ptc.hashid, _ps_ptable->ssize);
lock_get(&_ps_ptable->slots[idx].lock);
ptn = _ps_ptable->slots[idx].plist;
ptc.event = *event;
ptc.etag = *etag;
ptc.hashid = core_case_hash(&ptc.user, &ptc.domain, 0);
- idx = ptc.hashid & (_ps_ptable->ssize - 1);
+ idx = core_hash_idx(ptc.hashid, _ps_ptable->ssize);
lock_get(&_ps_ptable->slots[idx].lock);
ptn = _ps_ptable->slots[idx].plist;