This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compute a 32-bit big-endian checksum on the N-byte buffer. If the | |
// buffer is not a multiple of 4 bytes length, compute the sum that would | |
// have occurred if the buffer was padded with zeros to the next multiple | |
// of four bytes. | |
public static uint Checksum(ReadOnlySpan<byte> arr) | |
{ | |
if (arr.Length == 0) return 0; | |
uint sum0 = 0, sum1 = 0, sum2 = 0, sum = 0, N = (uint)arr.Length; | |
int z = 0; |
NewerOlder