コード例 #1
0
            private int count; // mutate on construction

            private HashBucket(int hashRoll, uint used, AbstractBucket[] buckets, int count)
            {
                this.hashRoll = hashRoll & 31;
                this.used     = used;
                this.buckets  = buckets;
                this.count    = count;
                Debug.Assert(this.buckets.Length == BitArithmeticUtilities.CountBits(this.used));
            }
コード例 #2
0
            private int ComputePhysicalSlot(int logicalSlot)
            {
                Debug.Assert(logicalSlot >= 0 && logicalSlot < 32);
                if (this.buckets.Length == 32)
                {
                    return(logicalSlot);
                }

                if (logicalSlot == 0)
                {
                    return(0);
                }

                var mask = uint.MaxValue >> (32 - logicalSlot); // only count the bits up to the logical slot #

                return(BitArithmeticUtilities.CountBits(this.used & mask));
            }