public static ToUInt64 ( byte array, int offset ) : ulong | ||
array | byte | |
offset | int | |
리턴 | ulong |
public ulong ReadUInt64() { var v = LittleEndian.ToUInt64(_array, _cursor); _cursor += 8; return(v); }
public static ulong ReadCompact(byte[] source, int offset, out int bytesRead) { if (source == null) { throw new ArgumentNullException(nameof(source)); } var discriminant = source[offset]; switch (discriminant) { case 0xfd: bytesRead = 3; return(CanonicalCheck(LittleEndian.ToUInt16(source, offset + 1), 0xfd, discriminant)); case 0xfe: bytesRead = 5; return(CanonicalCheck(LittleEndian.ToUInt32(source, offset + 1), 0x10000, discriminant)); case 0xff: bytesRead = 9; return(CanonicalCheck(LittleEndian.ToUInt64(source, offset + 1), 0x100000000, discriminant)); default: bytesRead = 1; return(discriminant); } }