Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CalculateChecksum() [2/2]

static unsafe uint System.Reflection.PortableExecutable.PEBuilder.CalculateChecksum ( IEnumerable< Blob > blobs)
inlinestaticprivateinherited

Definition at line 405 of file PEBuilder.cs.

406 {
407 uint num = 0u;
408 int num2 = -1;
409 foreach (Blob blob in blobs)
410 {
412 fixed (byte* ptr = bytes.Array)
413 {
414 byte* ptr2 = ptr + bytes.Offset;
415 byte* ptr3 = ptr2 + bytes.Count;
416 if (num2 >= 0)
417 {
418 num = AggregateChecksum(num, (ushort)((*ptr2 << 8) | num2));
419 ptr2++;
420 }
421 if ((ptr3 - ptr2) % 2 != 0L)
422 {
423 ptr3--;
424 num2 = *ptr3;
425 }
426 else
427 {
428 num2 = -1;
429 }
430 for (; ptr2 < ptr3; ptr2 += 2)
431 {
432 num = AggregateChecksum(num, (ushort)((ptr2[1] << 8) | *ptr2));
433 }
434 }
435 }
436 if (num2 >= 0)
437 {
438 num = AggregateChecksum(num, (ushort)num2);
439 }
440 return num;
441 }
static uint AggregateChecksum(uint checksum, ushort value)
Definition PEBuilder.cs:443
ArraySegment< byte > GetBytes()
Definition Blob.cs:20

References System.Reflection.PortableExecutable.PEBuilder.AggregateChecksum(), System.bytes, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Reflection.Metadata.Blob.GetBytes(), and System.L.