public static BigEndianByteQuad FromUInt32(uint value) { var retval = new BigEndianByteQuad(); retval.Byte1 = (byte)((value >> 24) & 0xff); retval.Byte2 = (byte)((value >> 16) & 0xff); retval.Byte3 = (byte)((value >> 8) & 0xff); retval.Byte4 = (byte)((value >> 0) & 0xff); return retval; }
public static BigEndianByteQuad FromUInt32(uint value) { var retval = new BigEndianByteQuad(); retval.Byte1 = (byte)((value >> 24) & 0xff); retval.Byte2 = (byte)((value >> 16) & 0xff); retval.Byte3 = (byte)((value >> 8) & 0xff); retval.Byte4 = (byte)((value >> 0) & 0xff); return(retval); }
public static BigEndianByteQuad FromTimeSpan(TimeSpan timeSpan) { var retval = new BigEndianByteQuad(); var milliseconds = timeSpan.TotalMilliseconds; milliseconds /= 1000; milliseconds *= 0x10000; var x = (int)milliseconds; retval.Byte4 = (byte)(x & 0xf); retval.Byte3 = (byte)((x >> 8) & 0xf); retval.Byte2 = (byte)((x >> 16) & 0xf); retval.Byte1 = (byte)((x >> 24) & 0xf); return(retval); }
public static BigEndianByteQuad FromTimeSpan(TimeSpan timeSpan) { var retval = new BigEndianByteQuad(); var milliseconds = timeSpan.TotalMilliseconds; milliseconds /= 1000; milliseconds *= 0x10000; var x = (int)milliseconds; retval.Byte4 = (byte)(x & 0xf); retval.Byte3 = (byte)((x >> 8) & 0xf); retval.Byte2 = (byte)((x >> 16) & 0xf); retval.Byte1 = (byte)((x >> 24) & 0xf); return retval; }