fix Address::operator==()
diff --git a/readme.md b/readme.md
index 32dde63..a8fa375 100644
--- a/readme.md
+++ b/readme.md
@@ -1,5 +1,5 @@
 
-Xbyak 4.84 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
+Xbyak 4.85 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
 =============
 
 Abstract
@@ -277,6 +277,7 @@
 
 History
 -------------
+* 2015/Aug/10 ver 4.85 Address::operator==() is not correct(thanks to inolen)
 * 2015/Jun/22 ver 4.84 call() support variadic template if available(thanks to randomstuff)
 * 2015/Jun/16 ver 4.83 support movbe(thanks to benvanik)
 * 2015/May/24 ver 4.82 support detection of F16C
diff --git a/readme.txt b/readme.txt
index 815b3c5..5c698c9 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,5 +1,5 @@
 

-    C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.84

+    C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.85

 

 -----------------------------------------------------------------------------

 ◎概要

@@ -296,6 +296,7 @@
 -----------------------------------------------------------------------------

 ◎履歴

 

+2015/08/10 ver 4.85 Address::operator==()が間違っている(thanks to inolen)

 2015/07/22 ver 4.84 call()がvariadic template対応

 2015/05/24 ver 4.83 mobveサポート(thanks to benvanik)

 2015/05/24 ver 4.82 F16Cが使えるかどうかの判定追加

diff --git a/test/misc.cpp b/test/misc.cpp
index 76a4d56..9b33497 100644
--- a/test/misc.cpp
+++ b/test/misc.cpp
@@ -21,3 +21,14 @@
 		}
 	} code;
 }
+
+CYBOZU_TEST_AUTO(compOperand)
+{
+	using namespace Xbyak::util;
+	CYBOZU_TEST_ASSERT(eax == eax);
+	CYBOZU_TEST_ASSERT(ecx != xmm0);
+	CYBOZU_TEST_ASSERT(ptr[eax] == ptr[eax]);
+	CYBOZU_TEST_ASSERT(dword[eax] != ptr[eax]);
+	CYBOZU_TEST_ASSERT(ptr[eax] != ptr[eax+3]);
+	CYBOZU_TEST_ASSERT(ptr[eax] != ptr[eax+3]);
+}
\ No newline at end of file
diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h
index ee5b65d..13242b2 100644
--- a/xbyak/xbyak.h
+++ b/xbyak/xbyak.h
@@ -100,7 +100,7 @@
 
 enum {
 	DEFAULT_MAX_CODE_SIZE = 4096,
-	VERSION = 0x4840 /* 0xABCD = A.BC(D) */
+	VERSION = 0x4850 /* 0xABCD = A.BC(D) */
 };
 
 #ifndef MIE_INTEGER_TYPE_DEFINED
@@ -411,7 +411,8 @@
 		}
 		throw Error(ERR_INTERNAL);
 	}
-	bool operator==(const Operand& rhs) const { return idx_ == rhs.idx_ && kind_ == rhs.kind_ && bit_ == rhs.bit_; }
+	bool isSameNotInherited(const Operand& rhs) const { return idx_ == rhs.idx_ && kind_ == rhs.kind_ && bit_ == rhs.bit_; }
+	bool operator==(const Operand& rhs) const;
 	bool operator!=(const Operand& rhs) const { return !operator==(rhs); }
 };
 
@@ -870,8 +871,20 @@
 	void setRex(uint8 rex) { rex_ = rex; }
 	void setLabel(const Label* label) { label_ = label; }
 	const Label* getLabel() const { return label_; }
+	bool operator==(const Address& rhs) const
+	{
+		return getBit() == rhs.getBit() && size_ == rhs.size_ && rex_ == rhs.rex_ && disp_ == rhs.disp_ && label_ == rhs.label_ && isOnlyDisp_ == rhs.isOnlyDisp_
+			&& is64bitDisp_ == rhs.is64bitDisp_ && is32bit_ == rhs.is32bit_ && isVsib_ == rhs.isVsib_ && isYMM_ == rhs.isYMM_;
+	}
+	bool operator!=(const Address& rhs) const { return !operator==(rhs); }
 };
 
+inline bool Operand::operator==(const Operand& rhs) const
+{
+	if (isMEM() && rhs.isMEM()) return static_cast<const Address&>(*this) == static_cast<const Address&>(rhs);
+	return isSameNotInherited(rhs);
+}
+
 class AddressFrame {
 private:
 	void operator=(const AddressFrame&);
diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h
index 75d52e0..6f3bdb5 100644
--- a/xbyak/xbyak_mnemonic.h
+++ b/xbyak/xbyak_mnemonic.h
@@ -1,4 +1,4 @@
-const char *getVersionString() const { return "4.84"; }
+const char *getVersionString() const { return "4.85"; }
 void packssdw(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x6B); }
 void packsswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x63); }
 void packuswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x67); }