Exemple #1
0
 static byte ConvertBit(int value, BitDistributionAlgorithm algorithm)
 {
     value ++;
     if (value <= 0) {
         throw new ArgumentException ("value must be a positive integer.(value > 0)", "value");
     }
     switch (algorithm) {
     case BitDistributionAlgorithm.Linear:
         return (byte)Math.Min (value, 255);
     }
     throw new ArgumentOutOfRangeException ("algorithm");
 }
Exemple #2
0
 static byte ConvertBit(int value, BitDistributionAlgorithm algorithm)
 {
     value++;
     if (value <= 0)
     {
         throw new ArgumentException("value must be a positive integer.(value > 0)", "value");
     }
     switch (algorithm)
     {
     case BitDistributionAlgorithm.Linear:
         return((byte)Math.Min(value, 255));
     }
     throw new ArgumentOutOfRangeException("algorithm");
 }