Skip to content

Commit

Permalink
Remove Vector<T> dependency in wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
GrabYourPitchforks committed Mar 11, 2021
1 parent ee279d4 commit d13f660
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void ForbidUndefinedCharacters()
Debug.Assert(definedCharsBitmapAsLittleEndian.Length == thisAllowedCharactersBitmap.Length * sizeof(uint));

#if NETCOREAPP
if (BitConverter.IsLittleEndian)
if (Vector.IsHardwareAccelerated && BitConverter.IsLittleEndian)
{
while (!definedCharsBitmapAsLittleEndian.IsEmpty)
{
Expand All @@ -83,7 +83,7 @@ public void ForbidUndefinedCharacters()
}
#endif

// Not Core, or not little-endian.
// Not Core, or not little-endian, or not SIMD-optimized.
for (int i = 0; i < thisAllowedCharactersBitmap.Length; i++)
{
thisAllowedCharactersBitmap[i] &= BinaryPrimitives.ReadUInt32LittleEndian(definedCharsBitmapAsLittleEndian.Slice(i * sizeof(uint)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal sealed partial class OptimizedInboxTextEncoder
/// <summary>
/// A bitmap which represents allowed ASCII code points.
/// </summary>
[StructLayout(LayoutKind.Explicit)]
[StructLayout(LayoutKind.Explicit, Size = 16)]
private unsafe partial struct AllowedAsciiCodePoints
{
[FieldOffset(0)] // if we're compiling SIMD-enabled, check the .Simd.cs file for the vector field at this offset
Expand Down

0 comments on commit d13f660

Please sign in to comment.