Beispiel #1
0
 public void CopyBytes(UInt24 value, byte[] destinationArray, int destinationIndex)
 {
     m_copyBuffer(UInt24.GetBytes(value), 0, destinationArray, destinationIndex, 3);
 }
Beispiel #2
0
 public static UInt24 ClearBits(this UInt24 source, UInt24 bits)
 {
     return (source & ~bits);
 }
Beispiel #3
0
 public byte[] GetBytes(UInt24 value)
 {
     return m_coerceByteOrder(UInt24.GetBytes(value));
 }
Beispiel #4
0
 public static UInt24 SetMaskedValue(this UInt24 source, UInt24 bitmask, UInt24 value)
 {
     return ((source & ~bitmask) | value);
 }
Beispiel #5
0
 public static UInt24 SetBits(this UInt24 source, UInt24 bits)
 {
     return (source | bits);
 }
Beispiel #6
0
 public static Int24 ToInt24(UInt24 unsignedInt)
 {
     return Int24.GetValue(UInt24.GetBytes(unsignedInt), 0);
 }
Beispiel #7
0
 public static UInt24 SetMaskedValue(this UInt24 source, Bits bitmask, UInt24 value)
 {
     checked
     {
         return SetMaskedValue(source, (UInt24)bitmask, value);
     }
 }
Beispiel #8
0
 public static bool CheckBits(this UInt24 source, UInt24 bits, bool allBits)
 {
     return (allBits ? ((source & bits) == bits) : ((source & bits) != 0));
 }
Beispiel #9
0
 public static UInt24 ToggleBits(this UInt24 source, UInt24 bits)
 {
     return (source ^ bits);
 }
Beispiel #10
0
 public Int24(UInt24 value) : this(unchecked ((int)value._value))
 {
 }
Beispiel #11
0
 public static bool CheckBits(this UInt24 source, UInt24 bits)
 {
     return CheckBits(source, bits, true);
 }
Beispiel #12
0
 public Int24(UInt24 value) : this((int)value._value)
 {
 }
Beispiel #13
0
 public BmsPoint(UInt24 position)
     : this()
 {
     Position = position;
 }
Beispiel #14
0
 public void WriteDelay(UInt24 value)
 {
     if (value > 0xFFFF) {
         mWriter.Write8(0xEA); // CF is not supported
         mWriter.Write24(value);
     }
     else {
         WriteDelay((ushort)value);
     }
 }
Beispiel #15
0
        /// <summary>
        /// Generates a cryptographically strong unsigned 24-bit random integer between specified values.
        /// </summary>
        /// <exception cref="System.Security.Cryptography.CryptographicException">The cryptographic service provider (CSP) cannot be acquired.</exception>
        /// <param name="startNumber">A <see cref="UInt24"/> that is the low end of our range.</param>
        /// <param name="stopNumber">A <see cref="UInt24"/> that is the high end of our range.</param>
        /// <returns>A <see cref="UInt24"/> that is generated between the <paramref name="startNumber"/> and the <paramref name="stopNumber"/>.</returns>
        public static UInt24 Int24Between(UInt24 startNumber, UInt24 stopNumber)
        {
            if (stopNumber < startNumber)
                throw new ArgumentException("stopNumber must be greater than startNumber");

            return (UInt24)(Number * (stopNumber - startNumber) + startNumber);
        }
Beispiel #16
0
 public static UInt24 GetMaskedValue(this UInt24 source, UInt24 bitmask)
 {
     return (source & bitmask);
 }
Beispiel #17
0
        /// <summary>
        /// Generates a cryptographically strong unsigned 24-bit random integer between specified values. i.e. [<paramref name="startNumber"/>-<paramref name="stopNumber"/>)
        /// </summary>
        /// <exception cref="CryptographicException">The cryptographic service provider (CSP) cannot be acquired.</exception>
        /// <param name="startNumber">A <see cref="UInt24"/> that is the low end of our range.</param>
        /// <param name="stopNumber">A <see cref="UInt24"/> that is the high end of our range.</param>
        /// <returns>A <see cref="UInt24"/> that is generated between the <paramref name="startNumber"/> and the <paramref name="stopNumber"/>.</returns>
        public static UInt24 Int24Between(UInt24 startNumber, UInt24 stopNumber)
        {
            if (stopNumber < startNumber)
                throw new ArgumentException("stopNumber must be greater than startNumber");

            return (UInt24)(GetRandomNumberLessThan((uint)stopNumber - (uint)startNumber) + (uint)startNumber);
        }
Beispiel #18
0
 /// <summary>
 /// Write an unsigned 24bit value based on the current stream and bit position
 /// </summary>
 public void WriteUInt24(UInt24 value)
 {
     WriteBytes(BitConverter.GetBytes(value), 24);
 }