porting bitops and zset