Skip to content

Instantly share code, notes, and snippets.

@jzebedee
Created July 22, 2014 15:04
Show Gist options
  • Save jzebedee/51625c37d8e1e6da3c84 to your computer and use it in GitHub Desktop.
Save jzebedee/51625c37d8e1e6da3c84 to your computer and use it in GitHub Desktop.
old/new Write64 IL diff
Text Compare
Produced: 7/22/2014 10:02:39 AM
Mode: All
Left file: C:\Users\\Desktop\old_Write64.txt Right file: C:\Users\\Desktop\new_Write64.txt
1 .method private hidebysig static = 1 .method private hidebysig static
2 void WriteInt64 ( 2 void WriteInt64 (
3 int64 'value', 3 int64 'value',
4 uint8[] buf, 4 uint8[] buf,
5 int32 offset 5 int32 offset
6 ) cil managed 6 ) cil managed
7 { 7 {
------------------------------------------------------------------------
8 // Method begins at RVA 0x2e70 <> 8 // Method begins at RVA 0x2eb4
9 // Code size 88 (0x58) 9 // Code size 86 (0x56)
10 .maxstack 4 10 .maxstack 3
------------------------------------------------------------------------
11 .locals init ( = 11 .locals init (
------------------------------------------------------------------------
12 [0] int64 valueToWrite, <> 12 [0] int32 i,
13 [1] int32 byteIndex 13 [1] int32 i
------------------------------------------------------------------------
14 ) = 14 )
15 15
16 IL_0000: ldarg.0 16 IL_0000: ldarg.0
17 IL_0001: ldc.i4.0 17 IL_0001: ldc.i4.0
18 IL_0002: conv.i8 18 IL_0002: conv.i8
------------------------------------------------------------------------
19 IL_0003: blt.s IL_0008 <> 19 IL_0003: bge.s IL_003d
------------------------------------------------------------------------
20 = 20
21 IL_0005: ldarg.0 21 IL_0005: ldarg.0
------------------------------------------------------------------------
22 IL_0006: br.s IL_000a <> 22 IL_0006: neg
23
24 IL_0008: ldarg.0 23 IL_0007: starg.s 'value'
25 IL_0009: neg 24 IL_0009: ldc.i4.m1
26
------------------------------------------------------------------------
27 IL_000a: stloc.0 = 25 IL_000a: stloc.0
------------------------------------------------------------------------
28 IL_000b: ldc.i4.0 <>
29 IL_000c: stloc.1
30 IL_000d: br.s IL_0033 26 IL_000b: br.s IL_0019
31 // loop start (head: IL_0033) 27 // loop start (head: IL_0019)
32 IL_000f: ldarg.1 28 IL_000d: ldarg.1
33 IL_0010: ldarg.2 29 IL_000e: ldarg.2
34 IL_0011: ldloc.1 30 IL_000f: ldloc.0
35 IL_0012: add 31 IL_0010: add
36 IL_0013: ldloc.0 32 IL_0011: ldarg.0
37 IL_0014: ldc.i4 256
38 IL_0019: conv.i8
39 IL_001a: rem
40 IL_001b: conv.u1 33 IL_0012: conv.u1
41 IL_001c: stelem.i1 34 IL_0013: stelem.i1
42 IL_001d: ldloc.0
43 IL_001e: ldarg.1 35 IL_0014: ldarg.0
44 IL_001f: ldarg.2
45 IL_0020: ldloc.1 36 IL_0015: ldc.i4.8
46 IL_0021: add 37 IL_0016: shr
47 IL_0022: ldelem.u1
48 IL_0023: conv.u8
49 IL_0024: sub
50 IL_0025: stloc.0
51 IL_0026: ldloc.0
52 IL_0027: ldc.i4 256
53 IL_002c: conv.i8
54 IL_002d: div
55 IL_002e: stloc.0 38 IL_0017: starg.s 'value'
39
56 IL_002f: ldloc.1 40 IL_0019: ldloc.0
57 IL_0030: ldc.i4.1 41 IL_001a: ldc.i4.1
58 IL_0031: add 42 IL_001b: add
59 IL_0032: stloc.1 43 IL_001c: dup
60
61 IL_0033: ldloc.1 44 IL_001d: stloc.0
62 IL_0034: ldc.i4.8 45 IL_001e: ldc.i4.8
63 IL_0035: blt.s IL_000f 46 IL_001f: blt.s IL_000d
------------------------------------------------------------------------
64 // end loop = 47 // end loop
65 48
------------------------------------------------------------------------
66 IL_0037: ldarg.0 <> 49 IL_0021: ldarg.1
50 IL_0022: ldarg.2
51 IL_0023: ldc.i4.7
52 IL_0024: add
53 IL_0025: ldelema [mscorlib]System.Byte
54 IL_002a: dup
55 IL_002b: ldobj [mscorlib]System.Byte
67 IL_0038: ldc.i4.0 56 IL_0030: ldc.i4 128
57 IL_0035: or
68 IL_0039: conv.i8 58 IL_0036: conv.u1
59 IL_0037: stobj [mscorlib]System.Byte
60 IL_003c: ret
61
62 IL_003d: ldc.i4.m1
63 IL_003e: stloc.1
69 IL_003a: bge.s IL_0057 64 IL_003f: br.s IL_004d
70 65 // loop start (head: IL_004d)
71 IL_003c: ldarg.1 66 IL_0041: ldarg.1
72 IL_003d: ldarg.2 67 IL_0042: ldarg.2
73 IL_003e: ldc.i4.7 68 IL_0043: ldloc.1
74 IL_003f: add 69 IL_0044: add
75 IL_0040: ldelema [mscorlib]System.Byte
76 IL_0045: dup 70 IL_0045: ldarg.0
71 IL_0046: conv.u1
77 IL_0046: ldobj [mscorlib]System.Byte 72 IL_0047: stelem.i1
73 IL_0048: ldarg.0
78 IL_004b: ldc.i4 128 74 IL_0049: ldc.i4.8
75 IL_004a: shr
76 IL_004b: starg.s 'value'
77
78 IL_004d: ldloc.1
79 IL_004e: ldc.i4.1
80 IL_004f: add
79 IL_0050: or 81 IL_0050: dup
80 IL_0051: conv.u1 82 IL_0051: stloc.1
81 IL_0052: stobj [mscorlib]System.Byte 83 IL_0052: ldc.i4.8
84 IL_0053: blt.s IL_0041
85 // end loop
------------------------------------------------------------------------
82 = 86
------------------------------------------------------------------------
83 IL_0057: ret <> 87 IL_0055: ret
------------------------------------------------------------------------
84 } // end of method BinaryPatchUtility::WriteInt64 = 88 } // end of method BinaryPatchUtility::WriteInt64
------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment