You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[crc64] Fix a subtle bug in CRC64 splice-by-8 implementation (#627)
Commit 9b88ce7 implemented a splice-by-8 version of the CRC64
algorithm which processes 8 bytes per loop iteration. However, the
code had a subtle bug which resulted in the same CRC calculated for
different strings and made some of the Xamarin.Android tests to fail.
The following strings yielded the same checksum value:
* `obj/Debug/lp/10/jl/bin/classes.jar`
* `obj/Debug/lp/11/jl/bin/classes.jar`
* `obj/Debug/lp/12/jl/bin/classes.jar`
The reason for this was subtle (a stupid oversight on my part, really):
the loop fetched values from the input array by using an index into
the array:
crc ^= (ulong)aptr[idx];
However, with `aptr` being declared as `byte* aptr` the indexing
operation returned a single *byte* instead of the required 64-bit word
(8 bytes) and, thus, on each iteration of the loop 7 bytes of the input
arrays were ignored in calculation, thus causing the collisions.
The fix is to cast `aptr` to `ulong*` and *then* index it, extracting
the required 8 bytes.
This commit also adds a test to check for this issue.
Copy file name to clipboardExpand all lines: tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers/JavaCallableWrapperGeneratorTests.cs
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,7 @@ public void GenerateIndirectApplication (
Copy file name to clipboardExpand all lines: tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers/JavaNativeTypeManagerTests.cs
Copy file name to clipboardExpand all lines: tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers/TypeNameMapGeneratorTests.cs
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -59,12 +59,12 @@ public void WriteJavaToManaged ()
0 commit comments