public void CopyBytes(UInt24 value, byte[] destinationArray, int destinationIndex) { m_copyBuffer(UInt24.GetBytes(value), 0, destinationArray, destinationIndex, 3); }
public static UInt24 ClearBits(this UInt24 source, UInt24 bits) { return (source & ~bits); }
public byte[] GetBytes(UInt24 value) { return m_coerceByteOrder(UInt24.GetBytes(value)); }
public static UInt24 SetMaskedValue(this UInt24 source, UInt24 bitmask, UInt24 value) { return ((source & ~bitmask) | value); }
public static UInt24 SetBits(this UInt24 source, UInt24 bits) { return (source | bits); }
public static Int24 ToInt24(UInt24 unsignedInt) { return Int24.GetValue(UInt24.GetBytes(unsignedInt), 0); }
public static UInt24 SetMaskedValue(this UInt24 source, Bits bitmask, UInt24 value) { checked { return SetMaskedValue(source, (UInt24)bitmask, value); } }
public static bool CheckBits(this UInt24 source, UInt24 bits, bool allBits) { return (allBits ? ((source & bits) == bits) : ((source & bits) != 0)); }
public static UInt24 ToggleBits(this UInt24 source, UInt24 bits) { return (source ^ bits); }
public Int24(UInt24 value) : this(unchecked ((int)value._value)) { }
public static bool CheckBits(this UInt24 source, UInt24 bits) { return CheckBits(source, bits, true); }
public Int24(UInt24 value) : this((int)value._value) { }
public BmsPoint(UInt24 position) : this() { Position = position; }
public void WriteDelay(UInt24 value) { if (value > 0xFFFF) { mWriter.Write8(0xEA); // CF is not supported mWriter.Write24(value); } else { WriteDelay((ushort)value); } }
/// <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); }
public static UInt24 GetMaskedValue(this UInt24 source, UInt24 bitmask) { return (source & bitmask); }
/// <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); }
/// <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); }