From 8168dcc42ba24c241e150046a39e47da996bae01 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Nov 2015 14:41:27 -0500 Subject: [PATCH 1/3] Match the type of `n' to source data type `size_t'. --- Source/Project64/N64 System/Mips/TLB class.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64/N64 System/Mips/TLB class.cpp b/Source/Project64/N64 System/Mips/TLB class.cpp index c9b095870..9b18ba001 100644 --- a/Source/Project64/N64 System/Mips/TLB class.cpp +++ b/Source/Project64/N64 System/Mips/TLB class.cpp @@ -303,7 +303,7 @@ void CTLB::RecordDifference( CLog &LogFile, const CTLB& rTLB) bool CTLB::operator == (const CTLB& rTLB) const { - for (int i = 0, n = sizeof(m_tlb)/sizeof(m_tlb[0]); i < n; i++) + for (size_t i = 0, n = sizeof(m_tlb)/sizeof(m_tlb[0]); i < n; i++) { if (m_tlb[i].EntryDefined != rTLB.m_tlb[i].EntryDefined) { From 9cc0465a102b586c457bd4fc9c1f6634aae7f974 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Nov 2015 14:50:16 -0500 Subject: [PATCH 2/3] Re-express `/ sizeof(array[0])' as `/ sizeof(array_type)'. --- Source/Project64/N64 System/Mips/TLB class.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Project64/N64 System/Mips/TLB class.cpp b/Source/Project64/N64 System/Mips/TLB class.cpp index 9b18ba001..949f3fccc 100644 --- a/Source/Project64/N64 System/Mips/TLB class.cpp +++ b/Source/Project64/N64 System/Mips/TLB class.cpp @@ -303,7 +303,8 @@ void CTLB::RecordDifference( CLog &LogFile, const CTLB& rTLB) bool CTLB::operator == (const CTLB& rTLB) const { - for (size_t i = 0, n = sizeof(m_tlb)/sizeof(m_tlb[0]); i < n; i++) + const size_t n = sizeof(m_tlb) / sizeof(TLB_ENTRY); + for (size_t i = 0; i < n; i++) { if (m_tlb[i].EntryDefined != rTLB.m_tlb[i].EntryDefined) { From 7cae59ac0318194a5cf5842ad96a472e20b95dbf Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Nov 2015 16:22:53 -0500 Subject: [PATCH 3/3] reverted: sizeof(array[0]) is less error-prone. --- Source/Project64/N64 System/Mips/TLB class.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64/N64 System/Mips/TLB class.cpp b/Source/Project64/N64 System/Mips/TLB class.cpp index 949f3fccc..4ae8b4d25 100644 --- a/Source/Project64/N64 System/Mips/TLB class.cpp +++ b/Source/Project64/N64 System/Mips/TLB class.cpp @@ -303,7 +303,7 @@ void CTLB::RecordDifference( CLog &LogFile, const CTLB& rTLB) bool CTLB::operator == (const CTLB& rTLB) const { - const size_t n = sizeof(m_tlb) / sizeof(TLB_ENTRY); + const size_t n = sizeof(m_tlb) / sizeof(m_tlb[0]); for (size_t i = 0; i < n; i++) { if (m_tlb[i].EntryDefined != rTLB.m_tlb[i].EntryDefined)