Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2018-03-19 18:40:07 +0300
committerMarek Safar <marek.safar@gmail.com>2018-03-19 18:40:07 +0300
commit9e9ac9e00d6033417b267618714e336a79538c39 (patch)
tree7708126a943289e39af06b700f95554a587cfcdb
parent3af0d49e577721ff261a2428dd5eca20981fe8cb (diff)
Fixes memory alignment issues
-rw-r--r--src/System.Private.CoreLib/src/System/String.Comparison.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/System.Private.CoreLib/src/System/String.Comparison.cs b/src/System.Private.CoreLib/src/System/String.Comparison.cs
index b2ba02952..a33b7fcd1 100644
--- a/src/System.Private.CoreLib/src/System/String.Comparison.cs
+++ b/src/System.Private.CoreLib/src/System/String.Comparison.cs
@@ -129,6 +129,15 @@ namespace System
}
#endif // BIT64
+#if MONO
+ char* ptr2 = (char*)strBChars;
+ while ((count -= 1) >= 0)
+ {
+ if ((*((char*)((byte*)ptr2 + diff)) - *ptr2) != 0)
+ return ((int)*((char*)((byte*)ptr2 + diff)) - (int)*ptr2);
+ ++ptr2;
+ }
+#else
// Loop comparing a DWORD at a time.
// Reads are potentially unaligned
while ((count -= 2) >= 0)
@@ -148,6 +157,7 @@ namespace System
if (count == -1)
if ((c = *((char*)((byte*)strBChars + diff)) - *((char*)strBChars)) != 0)
return c;
+#endif
}
return countA - countB;