Example #1
0
 public void CopyBytes(UInt24 value, byte[] destinationArray, int destinationIndex)
 {
     m_copyBuffer(UInt24.GetBytes(value), 0, destinationArray, destinationIndex, 3);
 }
Example #2
0
 public static UInt24 ClearBits(this UInt24 source, UInt24 bits)
 {
     return (source & ~bits);
 }
Example #3
0
 public byte[] GetBytes(UInt24 value)
 {
     return m_coerceByteOrder(UInt24.GetBytes(value));
 }
Example #4
0
 public static UInt24 SetMaskedValue(this UInt24 source, UInt24 bitmask, UInt24 value)
 {
     return ((source & ~bitmask) | value);
 }
Example #5
0
 public static UInt24 SetBits(this UInt24 source, UInt24 bits)
 {
     return (source | bits);
 }
Example #6
0
 public static Int24 ToInt24(UInt24 unsignedInt)
 {
     return Int24.GetValue(UInt24.GetBytes(unsignedInt), 0);
 }
Example #7
0
 public static UInt24 SetMaskedValue(this UInt24 source, Bits bitmask, UInt24 value)
 {
     checked
     {
         return SetMaskedValue(source, (UInt24)bitmask, value);
     }
 }
Example #8
0
 public static bool CheckBits(this UInt24 source, UInt24 bits, bool allBits)
 {
     return (allBits ? ((source & bits) == bits) : ((source & bits) != 0));
 }
Example #9
0
 public static UInt24 ToggleBits(this UInt24 source, UInt24 bits)
 {
     return (source ^ bits);
 }
Example #10
0
 public Int24(UInt24 value) : this(unchecked ((int)value._value))
 {
 }
Example #11
0
 public static bool CheckBits(this UInt24 source, UInt24 bits)
 {
     return CheckBits(source, bits, true);
 }
Example #12
0
 public Int24(UInt24 value) : this((int)value._value)
 {
 }
Example #13
0
 public BmsPoint(UInt24 position)
     : this()
 {
     Position = position;
 }
Example #14
0
 public void WriteDelay(UInt24 value)
 {
     if (value > 0xFFFF) {
         mWriter.Write8(0xEA); // CF is not supported
         mWriter.Write24(value);
     }
     else {
         WriteDelay((ushort)value);
     }
 }
Example #15
0
File: Random.cs Project: avs009/gsf
        /// <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);
        }
Example #16
0
 public static UInt24 GetMaskedValue(this UInt24 source, UInt24 bitmask)
 {
     return (source & bitmask);
 }
Example #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);
        }
Example #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);
 }