Ejemplo n.º 1
0
 public Nibble(bool three,
               bool two,
               bool one,
               bool zero)
 {
     High = new Bit2(three, two);
     Low  = new Bit2(one, zero);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a Nibble from a value from 0 to 15
        /// </summary>
        /// <param name="value">0 to and including 15</param>
        public Nibble(byte value)
        {
            if (value > 15)
            {
                throw new ArgumentOutOfRangeException("value", "Value should be from 0 to (including) 15");
            }

            var binary = Convert.ToString(value, 2).PadLeft(4, '0');

            High = new Bit2(binary.Substring(0, 2));
            Low  = new Bit2(binary.Substring(2, 2));
        }
Ejemplo n.º 3
0
 public Nibble(Bit2 high, Bit2 low)
 {
     High = high;
     Low  = low;
 }
Ejemplo n.º 4
0
 public Nibble(string value)
 {
     High = new Bit2(value.Substring(0, 2));
     Low  = new Bit2(value.Substring(2, 2));
 }