All pastes #933206 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-03-08 04:38 UTC
rendered paste body
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 97341)
+++ ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2008-03-08  Sebastien Pouliot  <sebastien@ximian.com>
+
+	* Mono.Cecil.Cil/OpCode.cs
+	* Mono.Cecil.Binary/RVA.cs
+	* Mono.Cecil.Binary/DataDirectory.cs:
+		Avoid boxing/unboxing when == or != operators are used.
+		Results in significant memory savings for Gendarme.
+
 2008-02-26  Jb Evain  <jbevain@novell.com>
 
 	* Mono.Cecil.Binary/ImageReader.cs:
Index: Mono.Cecil.Cil/OpCode.cs
===================================================================
--- Mono.Cecil.Cil/OpCode.cs	(revision 97341)
+++ Mono.Cecil.Cil/OpCode.cs	(working copy)
@@ -123,12 +123,12 @@
 
 		public static bool operator == (OpCode one, OpCode other)
 		{
-			return one.Equals (other);
+			return ((one.m_op1 == other.m_op1) && (one.m_op2 == other.m_op2));
 		}
 
 		public static bool operator != (OpCode one, OpCode other)
 		{
-			return !one.Equals (other);
+			return ((one.m_op1 != other.m_op1) || (one.m_op2 != other.m_op2));
 		}
 
 		public override string ToString ()
Index: Mono.Cecil.Binary/RVA.cs
===================================================================
--- Mono.Cecil.Binary/RVA.cs	(revision 97341)
+++ Mono.Cecil.Binary/RVA.cs	(working copy)
@@ -64,12 +64,12 @@
 
 		public static bool operator == (RVA one, RVA other)
 		{
-			return one.Equals (other);
+			return (one.m_rva == other.m_rva);
 		}
 
 		public static bool operator != (RVA one, RVA other)
 		{
-			return !one.Equals (other);
+			return (one.m_rva != other.m_rva);
 		}
 
 		public static bool operator < (RVA one, RVA other)
Index: Mono.Cecil.Binary/DataDirectory.cs
===================================================================
--- Mono.Cecil.Binary/DataDirectory.cs	(revision 97341)
+++ Mono.Cecil.Binary/DataDirectory.cs	(working copy)
@@ -76,12 +76,12 @@
 
 		public static bool operator == (DataDirectory one, DataDirectory other)
 		{
-			return one.Equals (other);
+			return ((one.m_virtualAddress == other.m_virtualAddress) && (one.m_size == other.m_size));
 		}
 
 		public static bool operator != (DataDirectory one, DataDirectory other)
 		{
-			return !one.Equals (other);
+			return ((one.m_virtualAddress != other.m_virtualAddress) || (one.m_size != other.m_size));
 		}
 	}
 }