Skip to content

Instantly share code, notes, and snippets.

@akeit0
Created September 27, 2024 08:29
Show Gist options
  • Select an option

  • Save akeit0/7c0c3b6db335680c79d7ac73d1d4b258 to your computer and use it in GitHub Desktop.

Select an option

Save akeit0/7c0c3b6db335680c79d7ac73d1d4b258 to your computer and use it in GitHub Desktop.
using System;
public class C {
public int M(int[,] array,int i,int j) {
return array[i,j];
}
public int M(int[][] array,int i,int j) {
return array[i][j];
}
}
; Core CLR 8.0.824.36612 on x64
C..ctor()
L0000: ret
C.M(Int32[,], Int32, Int32)
L0000: sub rsp, 0x28
L0004: sub r8d, [rdx+0x18]
L0008: cmp r8d, [rdx+0x10]
L000c: jae short L002d
L000e: mov eax, [rdx+0x14]
L0011: imul r8d, eax
L0015: sub r9d, [rdx+0x1c]
L0019: cmp r9d, eax
L001c: jae short L002d
L001e: add r8d, r9d
L0021: mov eax, r8d
L0024: mov eax, [rdx+rax*4+0x20]
L0028: add rsp, 0x28
L002c: ret
L002d: call 0x00007ffebed5f8f0
L0032: int3
C.M(Int32[][], Int32, Int32)
L0000: sub rsp, 0x28
L0004: cmp r8d, [rdx+8]
L0008: jae short L0024
L000a: mov eax, r8d
L000d: mov rax, [rdx+rax*8+0x10]
L0012: cmp r9d, [rax+8]
L0016: jae short L0024
L0018: mov ecx, r9d
L001b: mov eax, [rax+rcx*4+0x10]
L001f: add rsp, 0x28
L0023: ret
L0024: call 0x00007ffebed5f8f0
L0029: int3
{
"version": 1,
"target": "JIT ASM",
"mode": "Release",
"branch": "core-x64"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment