summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-05-02 22:47:04 -0400
committerLioncash <mathew1800@gmail.com>2014-05-29 21:44:41 -0400
commit49b0eef393f4d321928fb0b6093d58a7637cf1da (patch)
tree741357c06acd966494684f8fdd4ec89e961d9887 /Source/Core/Common
parent30973459292d734fac12d1fefaf98edf37ad7976 (diff)
Remove the min/max functions in CommonFuncs.
The algorithm header has the same functions.
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/CommonFuncs.h9
-rw-r--r--Source/Core/Common/Hash.cpp14
-rw-r--r--Source/Core/Common/SysConf.h3
-rw-r--r--Source/Core/Common/stdafx.h4
4 files changed, 12 insertions, 18 deletions
diff --git a/Source/Core/Common/CommonFuncs.h b/Source/Core/Common/CommonFuncs.h
index e2ee8936a1..a4a5d8baa6 100644
--- a/Source/Core/Common/CommonFuncs.h
+++ b/Source/Core/Common/CommonFuncs.h
@@ -158,15 +158,6 @@ extern "C" {
#endif // M_IX86
#endif // WIN32 ndef
-// Dolphin's min and max functions
-#undef min
-#undef max
-
-template<class T>
-inline T min(const T& a, const T& b) {return a > b ? b : a;}
-template<class T>
-inline T max(const T& a, const T& b) {return a > b ? a : b;}
-
// Generic function to get last error message.
// Call directly after the command or use the error num.
// This function might change the error code.
diff --git a/Source/Core/Common/Hash.cpp b/Source/Core/Common/Hash.cpp
index f7ed8f308f..e346dba796 100644
--- a/Source/Core/Common/Hash.cpp
+++ b/Source/Core/Common/Hash.cpp
@@ -2,7 +2,7 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-
+#include <algorithm>
#include "Common/Hash.h"
#if _M_SSE >= 0x402
#include "Common/CPUDetect.h"
@@ -155,7 +155,7 @@ u64 GetMurmurHash3(const u8 *src, int len, u32 samples)
const u8 * data = (const u8*)src;
const int nblocks = len / 16;
u32 Step = (len / 8);
- if (samples == 0) samples = max(Step, 1u);
+ if (samples == 0) samples = std::max(Step, 1u);
Step = Step / samples;
if (Step < 1) Step = 1;
@@ -233,7 +233,7 @@ u64 GetCRC32(const u8 *src, int len, u32 samples)
u32 Step = (len / 8);
const u64 *data = (const u64 *)src;
const u64 *end = data + Step;
- if (samples == 0) samples = max(Step, 1u);
+ if (samples == 0) samples = std::max(Step, 1u);
Step = Step / samples;
if (Step < 1) Step = 1;
while (data < end)
@@ -265,7 +265,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
u32 Step = (len / 8);
const u64 *data = (const u64 *)src;
const u64 *end = data + Step;
- if (samples == 0) samples = max(Step, 1u);
+ if (samples == 0) samples = std::max(Step, 1u);
Step = Step / samples;
if (Step < 1) Step = 1;
while (data < end)
@@ -308,7 +308,7 @@ u64 GetCRC32(const u8 *src, int len, u32 samples)
u32 Step = (len/4);
const u32 *data = (const u32 *)src;
const u32 *end = data + Step;
- if (samples == 0) samples = max(Step, 1u);
+ if (samples == 0) samples = std::max(Step, 1u);
Step = Step / samples;
if (Step < 1) Step = 1;
while (data < end)
@@ -380,7 +380,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
u32 out[2];
const int nblocks = len / 8;
u32 Step = (len / 4);
- if (samples == 0) samples = max(Step, 1u);
+ if (samples == 0) samples = std::max(Step, 1u);
Step = Step / samples;
if (Step < 1) Step = 1;
@@ -456,7 +456,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
u32 Step = (len / 8);
const u64 *data = (const u64 *)src;
const u64 *end = data + Step;
- if (samples == 0) samples = max(Step, 1u);
+ if (samples == 0) samples = std::max(Step, 1u);
Step = Step / samples;
if (Step < 1) Step = 1;
while (data < end)
diff --git a/Source/Core/Common/SysConf.h b/Source/Core/Common/SysConf.h
index 0edd1bbd4a..bbdc998c21 100644
--- a/Source/Core/Common/SysConf.h
+++ b/Source/Core/Common/SysConf.h
@@ -4,6 +4,7 @@
#pragma once
+#include <algorithm>
#include <cstdio>
#include <cstring>
#include <string>
@@ -58,7 +59,7 @@ struct SSysConfEntry
{
if (buffer)
{
- memcpy(data, buffer, min<u16>(bufferSize, dataLength));
+ memcpy(data, buffer, std::min<u16>(bufferSize, dataLength));
return true;
}
return false;
diff --git a/Source/Core/Common/stdafx.h b/Source/Core/Common/stdafx.h
index 832a942e21..3142ff68d2 100644
--- a/Source/Core/Common/stdafx.h
+++ b/Source/Core/Common/stdafx.h
@@ -9,11 +9,13 @@
#define _WIN32_WINNT 0x501
#endif
#ifndef _WIN32_IE
-#define _WIN32_IE 0x0500 // Default value is 0x0400
+#define _WIN32_IE 0x0500 // Default value is 0x0400
#endif
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+#define NOMINMAX // Don't include windows min/max definitions
+
/*
#define _CRT_SECURE_NO_DEPRECATE 1
#define _CRT_NONSTDC_NO_DEPRECATE 1