예제 #1
0
        public void CheckWordsRequired()
        {
            for (int capacity = 0; capacity < maxBits; capacity++)
            {
                var required = BitVector.WordsRequired(capacity);
                var count    = BitVector.AllSet(capacity).Words().Count();

                Assert.Equal(count, required);
            }
        }
        private BitVector GetCapturedBitmask()
        {
            BitVector mask = BitVector.AllSet(nextVariableSlot);

            for (int slot = 1; slot < nextVariableSlot; slot++)
            {
                mask[slot] = IsCapturedInLocalFunction(slot);
            }

            return(mask);
        }
        private BitVector GetCapturedBitmask()
        {
            int       n    = variableBySlot.Count;
            BitVector mask = BitVector.AllSet(n);

            for (int slot = 1; slot < n; slot++)
            {
                mask[slot] = IsCapturedInLocalFunction(slot);
            }

            return(mask);
        }
예제 #4
0
 public void UpperBitsUnset()
 {
     for (int a = 0; a < 5; a++) // number of words
     {
         for (int b = -1; b < 2; b++) // number of bits more or less than that number of words
         {
             int n = BitVector.BitsPerWord * a + b;
             if (n < 0) continue;
             BitVector arr = BitVector.AllSet(n);
             if (n > 0) Assert.True(arr[n - 1]);
             Assert.False(arr[n]);
         }
     }
 }
예제 #5
0
        public void CheckWords()
        {
            for (int capacity = 0; capacity < maxBits; capacity++)
            {
                BitVector b = BitVector.Create(capacity);
                for (int i = 0; i < capacity; i++)
                {
                    b[i] = false;
                }

                var required = BitVector.WordsRequired(capacity);
                var count    = BitVector.AllSet(capacity).Words().Count();
            }
        }
 private LocalFunctionState CreateLocalFunctionState() =>
 new LocalFunctionState(
     // The bottom state should assume all variables, even new ones, are assigned
     new LocalState(BitVector.AllSet(variableBySlot.Count), normalizeToBottom: true),
     UnreachableState()
     );
 protected override LocalFunctionState CreateLocalFunctionState()
 => new LocalFunctionState(
     // The bottom state should assume all variables, even new ones, are assigned
     new LocalState(BitVector.AllSet(nextVariableSlot), normalizeToBottom: true),
     UnreachableState());