i noticed this today by inspection. the tag passed to rendezvous is usually
a naturally-aligned address. for the same size rendhash, we can get shorter
hash chains for the usual case by dropping the low-order bits.
the "2" assumes 32 bits, and should really be replaced by
log2ciel(sizeof(uintptr)).
but that's not constant.
/n/dump/2015/0207/sys/src/nix/port/portdat.h:489,495 - ../port/portdat.h:489,496
PGHLOG = 9,
PGHSIZE = 1<<PGHLOG, /* Page hash for image lookup */
};
- #define REND(p,s) ((p)->rendhash[(s)&((1<<RENDLOG)-1)])
+ /*
+ * assume natural alignment for minimum sized pointer
+ * 2 is a stand in for log2ciel(sizeof(uintptr))
+ */
+ #define REND(p,s) ((p)->rendhash[((s)>>2)&((1<<RENDLOG)-1)])
#define MOUNTH(p,qid) ((p)->mnthash[(qid).path&((1<<MNTLOG)-1)])
struct Pgrp
- erik