/// <summary> /// The value is packed with a loss of 2 bits /// </summary> /// <param name="writeBuffer">The buffer where we write the value to.</param> /// <param name="nullableValue">Value</param> /// <exception cref="System.ArgumentOutOfRangeException">value;Must be between 0 and + ZMaxValue</exception> public static void PackU(BinaryWriteBuffer writeBuffer, UInt32?nullableValue) { var length = nullableValue.HasValue ? GetULength(nullableValue.Value) : 1; var position = writeBuffer.Advance(length); PackU(writeBuffer.Buffer, position, length, nullableValue); }
/// <summary> /// The value is packed with a loss of 2 bits /// </summary> /// <param name="writeBuffer">The buffer where we write the value to.</param> /// <param name="value">Value</param> /// <exception cref="System.ArgumentOutOfRangeException">value;Must be between 0 and + ZMaxValue</exception> public static void Pack(BinaryWriteBuffer writeBuffer, UInt32 value) { if (value > ZMaxValue) { throw new ArgumentOutOfRangeException("value", value, "Must be between 0 and " + ZMaxValue); } var length = GetLength(value); var position = writeBuffer.Advance(length); Pack(writeBuffer.Buffer, position, length, value); }