Created
August 31, 2023 16:23
-
-
Save ogxd/72df6c6f60455e8c950de14c3c0c1a26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class C { | |
public static int GetUnrollCountWithDivision(ReadOnlySpan<byte> bytes) | |
{ | |
return bytes.Length >> 7 << 3; | |
} | |
public static int GetUnrollCountWithBitshift(ReadOnlySpan<byte> bytes) | |
{ | |
return bytes.Length / 128 * 8; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Core CLR 7.0.823.31807 on x86 | |
C..ctor() | |
L0000: ret | |
C.GetUnrollCountWithDivision(System.ReadOnlySpan`1<Byte>) | |
L0000: mov eax, [esp+8] | |
L0004: sar eax, 7 | |
L0007: shl eax, 3 | |
L000a: ret 8 | |
C.GetUnrollCountWithBitshift(System.ReadOnlySpan`1<Byte>) | |
L0000: mov eax, [esp+8] | |
L0004: mov edx, eax | |
L0006: sar edx, 0x1f | |
L0009: and edx, 0x7f | |
L000c: add eax, edx | |
L000e: sar eax, 7 | |
L0011: shl eax, 3 | |
L0014: ret 8 | |
Microsoft.CodeAnalysis.EmbeddedAttribute..ctor() | |
L0000: ret | |
System.Runtime.CompilerServices.RefSafetyRulesAttribute..ctor(Int32) | |
L0000: mov [ecx+4], edx | |
L0003: ret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": 1, | |
"target": "JIT ASM", | |
"mode": "Release", | |
"branch": "features-InlineArrays" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment