Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- DateTime a = new DateTime(100);
- DateTime b = new DateTime(200);
- DateTime c = new DateTime(50);
- Console.WriteLine(mathmin(a, b, c) + " " + ifmin(a, b, c));
- }
- static bool MathMin(DateTime a, DateTime b, DateTime c)
- {
- return Math.Min(a.Ticks, b.Ticks) > c.Ticks;
- }
- static bool IfMin(DateTime a, DateTime b, DateTime c)
- {
- return a > c && b > c;
- }
- }
- IL-Instructions MathMin
- 0 0000 nop
- 1 0001 ldarga.s a (0)
- 2 0003 call instance int64 [mscorlib]System.DateTime::get_Ticks()
- 0 0000 ldarg.0
- 1 0001 ldfld uint64 System.DateTime::dateData
- 2 0006 ldc.i8 0x3FFFFFFFFFFFFFFF
- 3 000F and
- 4 0010 ret
- 3 0008 ldarga.s b (1)
- 4 000A call instance int64 [mscorlib]System.DateTime::get_Ticks()
- 0 0000 ldarg.0
- 1 0001 ldfld uint64 System.DateTime::dateData
- 2 0006 ldc.i8 0x3FFFFFFFFFFFFFFF
- 3 000F and
- 4 0010 ret
- 5 000F call int64 [mscorlib]System.Math::Min(int64, int64)
- 0 0000 ldarg.0
- 1 0001 ldarg.1
- 2 0002 ble.s 5 (0006) ldarg.0
- 3 0004 ldarg.1
- 4 0005 ret
- 5 0006 ldarg.0
- 6 0007 ret
- 6 0014 ldarga.s c (2)
- 7 0016 call instance int64 [mscorlib]System.DateTime::get_Ticks()
- 0 0000 ldarg.0
- 1 0001 ldfld uint64 System.DateTime::dateData
- 2 0006 ldc.i8 0x3FFFFFFFFFFFFFFF
- 3 000F and
- 4 0010 ret
- 8 001B cgt
- 9 001D stloc.0
- 10 001E br.s 11 (0020) ldloc.0
- 11 0020 ldloc.0
- 12 0021 ret
- => 34 Instructions
- IL-Instructions IfMin
- 0 0000 nop
- 1 0001 ldarg.0
- 2 0002 ldarg.2
- 3 0003 call bool [mscorlib]System.DateTime::op_GreaterThan(valuetype [mscorlib]System.DateTime, valuetype [mscorlib]System.DateTime)
- 0 0000 ldarga.s t1 (0)
- 1 0002 call instance int64 System.DateTime::get_InternalTicks()
- 0 0000 ldarg.0
- 1 0001 ldfld uint64 System.DateTime::dateData
- 2 0006 ldc.i8 0x3FFFFFFFFFFFFFFF
- 3 000F and
- 4 0010 ret
- 2 0007 ldarga.s t2 (1)
- 3 0009 call instance int64 System.DateTime::get_InternalTicks()
- 0 0000 ldarg.0
- 1 0001 ldfld uint64 System.DateTime::dateData
- 2 0006 ldc.i8 0x3FFFFFFFFFFFFFFF
- 3 000F and
- 4 0010 ret
- 4 000E cgt
- 5 0010 ret
- 4 0008 brfalse.s 9 (0013) ldc.i4.0
- 5 000A ldarg.1
- 6 000B ldarg.2
- 7 000C call bool [mscorlib]System.DateTime::op_GreaterThan(valuetype [mscorlib]System.DateTime, valuetype [mscorlib]System.DateTime)
- 0 0000 ldarga.s t1 (0)
- 1 0002 call instance int64 System.DateTime::get_InternalTicks()
- 0 0000 ldarg.0
- 1 0001 ldfld uint64 System.DateTime::dateData
- 2 0006 ldc.i8 0x3FFFFFFFFFFFFFFF
- 3 000F and
- 4 0010 ret
- 2 0007 ldarga.s t2 (1)
- 3 0009 call instance int64 System.DateTime::get_InternalTicks()
- 0 0000 ldarg.0
- 1 0001 ldfld uint64 System.DateTime::dateData
- 2 0006 ldc.i8 0x3FFFFFFFFFFFFFFF
- 3 000F and
- 4 0010 ret
- 4 000E cgt
- 5 0010 ret
- 8 0011 br.s 10 (0014) stloc.0
- 9 0013 ldc.i4.0
- 10 0014 stloc.0
- 11 0015 br.s 12 (0017) ldloc.0
- 12 0017 ldloc.0
- 13 0018 ret
- => 45 Instructions
Add Comment
Please, Sign In to add comment