3 // Permission is hereby granted, free of charge, to any person obtaining
4 // a copy of this software and associated documentation files (the
5 // "Software"), to deal in the Software without restriction, including
6 // without limitation the rights to use, copy, modify, merge, publish,
7 // distribute, sublicense, and/or sell copies of the Software, and to
8 // permit persons to whom the Software is furnished to do so, subject to
9 // the following conditions:
11 // The above copyright notice and this permission notice shall be
12 // included in all copies or substantial portions of the Software.
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 * Copyright (c) 2002 Sergey Chaban <serge@wildwestsoftware.com>
29 namespace Mono
.PEToolkit
{
32 /// Relative Virtual Address.
36 public static readonly RVA Null
;
61 public void Write (BinaryWriter writer
)
66 public static implicit operator RVA (uint val
)
71 public static implicit operator uint (RVA rva
)
76 public override int GetHashCode()
81 public override bool Equals(object o
)
84 if (res
) res
= (this.value == ((RVA
)o
).value);
88 public static bool operator == (RVA rva1
, RVA rva2
)
90 return rva1
.Equals(rva2
);
93 public static bool operator != (RVA rva1
, RVA rva2
)
95 return !rva1
.Equals(rva2
);
98 public static bool operator < (RVA rva1
, RVA rva2
)
100 return (rva1
.value < rva2
.value);
103 public static bool operator > (RVA rva1
, RVA rva2
) {
104 return (rva1
.value > rva2
.value);
107 public static bool operator <= (RVA rva1
, RVA rva2
)
109 return (rva1
.value <= rva2
.value);
112 public static bool operator >= (RVA rva1
, RVA rva2
)
114 return (rva1
.value >= rva2
.value);
117 public static RVA
operator + (RVA rva
, uint x
)
119 return new RVA (rva
.value + x
);
122 public static RVA
operator - (RVA rva
, uint x
)
124 return new RVA (rva
.value - x
);
128 public override string ToString()
130 if (this == Null
) return "NULL";
131 return ("0x" + value.ToString("X"));
134 unsafe public static int Size
{
136 return sizeof (uint);