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

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Safar <marek.safar@gmail.com>2019-12-28 00:17:33 +0300
committerMarek Safar <marek.safar@gmail.com>2019-12-28 00:18:28 +0300
commitffc05559f94ea91e3c4ad1fb114d29805dea6840 (patch)
treefa43b5bdf6bd7ffbb309ef8317efc3e1339ea26f
parentbff1d77e7eeb929345fa0373e5d67b6e3f5be092 (diff)
Add mcs workarounds for CharUnicodeInfo
-rw-r--r--src/Common/src/CoreLib/System/Globalization/CharUnicodeInfo.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Common/src/CoreLib/System/Globalization/CharUnicodeInfo.cs b/src/Common/src/CoreLib/System/Globalization/CharUnicodeInfo.cs
index 3d0780b70a..dd698bca2c 100644
--- a/src/Common/src/CoreLib/System/Globalization/CharUnicodeInfo.cs
+++ b/src/Common/src/CoreLib/System/Globalization/CharUnicodeInfo.cs
@@ -128,7 +128,12 @@ namespace System.Globalization
// Note that & has the lower precedence than addition, so don't forget the parathesis.
index = NumericLevel2Index[(index << 4) + ((ch >> 4) & 0x000f)];
index = NumericLevel3Index[(index << 4) + (ch & 0x000f)];
+#if __MonoCS__
+ var temp = NumericValues[index * 8];
+ ref byte value = ref Unsafe.AsRef(ref temp);
+#else
ref byte value = ref Unsafe.AsRef(in NumericValues[index * 8]);
+#endif
if (BitConverter.IsLittleEndian)
{
@@ -255,7 +260,12 @@ namespace System.Globalization
int index = CategoryLevel1Index[ch >> 9];
// Get the level 2 WORD offset from the next 5 bits of ch. This provides the base offset of the level 3 table.
// Note that & has the lower precedence than addition, so don't forget the parathesis.
+#if __MonoCS__
+ var temp = CategoryLevel2Index[(index << 6) + ((ch >> 3) & 0b111110)];
+ index = Unsafe.ReadUnaligned<ushort>(ref Unsafe.AsRef(ref temp));
+#else
index = Unsafe.ReadUnaligned<ushort>(ref Unsafe.AsRef(in CategoryLevel2Index[(index << 6) + ((ch >> 3) & 0b111110)]));
+#endif
if (!BitConverter.IsLittleEndian)
{
index = BinaryPrimitives.ReverseEndianness((ushort)index);