diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb3ba02f95..dbc6907ca2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -259,8 +259,6 @@ add_library(Common STATIC
Common/KeyMap.h
Common/LogManager.cpp
Common/LogManager.h
- Common/MathUtil.cpp
- Common/MathUtil.h
Common/MemArena.cpp
Common/MemArena.h
Common/MemoryUtil.cpp
diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj
index 68f9eecc57..be412443ea 100644
--- a/Common/Common.vcxproj
+++ b/Common/Common.vcxproj
@@ -183,12 +183,10 @@
-
-
@@ -215,7 +213,6 @@
-
@@ -244,4 +241,4 @@
-
\ No newline at end of file
+
diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters
index 103d3a1c8f..c91b201d5a 100644
--- a/Common/Common.vcxproj.filters
+++ b/Common/Common.vcxproj.filters
@@ -16,11 +16,9 @@
-
-
@@ -46,7 +44,6 @@
-
@@ -76,4 +73,4 @@
{1b593f03-7b28-4707-9228-4981796f5589}
-
\ No newline at end of file
+
diff --git a/Common/MathUtil.cpp b/Common/MathUtil.cpp
deleted file mode 100644
index 1e4ef5aac3..0000000000
--- a/Common/MathUtil.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0 or later versions.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#include "MathUtil.h"
-
-int GetPow2(int x)
-{
- int ret = 0;
- int val = 1;
- while(x > val)
- {
- ret++;
- val *= 2;
- }
- return ret;
-}
-
diff --git a/Common/MathUtil.h b/Common/MathUtil.h
deleted file mode 100644
index 3ae49b39e1..0000000000
--- a/Common/MathUtil.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2003 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0 or later versions.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _MATH_UTIL_H_
-#define _MATH_UTIL_H_
-
-int GetPow2(int x);
-
-#endif // _MATH_UTIL_H_
diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp
index 09a8e4b008..e25954cafc 100644
--- a/Core/Util/PPGeDraw.cpp
+++ b/Core/Util/PPGeDraw.cpp
@@ -25,7 +25,6 @@
#include "Core/MemMap.h"
#include "image/zim_load.h"
#include "util/text/utf8.h"
-#include "MathUtil.h"
#include "Core/System.h"
static u32 atlasPtr;
@@ -746,6 +745,20 @@ void PPGeDrawImage(float x, float y, float w, float h, float u1, float v1, float
EndVertexDataAndDraw(GE_PRIM_RECTANGLES);
}
+// Return a value such that (1 << value) >= x
+int GetPow2(int x)
+{
+#ifdef __GNUC__
+ int ret = 31 - __builtin_clz(x|1);
+ if ((1 << ret) < x)
+#else
+ int ret = 0;
+ while ((1 << ret) < x)
+#endif
+ ret++;
+ return ret;
+}
+
void PPGeSetDefaultTexture()
{
WriteCmd(GE_CMD_TEXTUREMAPENABLE, 1);
diff --git a/Qt/Common.pro b/Qt/Common.pro
index a21543459d..594777668b 100755
--- a/Qt/Common.pro
+++ b/Qt/Common.pro
@@ -34,7 +34,6 @@ SOURCES += ../Common/ChunkFile.cpp \
../Common/FileUtil.cpp \
../Common/LogManager.cpp \
../Common/KeyMap.cpp \
- ../Common/MathUtil.cpp \
../Common/MemArena.cpp \
../Common/MemoryUtil.cpp \
../Common/Misc.cpp \
@@ -48,7 +47,6 @@ HEADERS += ../Common/ChunkFile.h \
../Common/FileUtil.h \
../Common/LogManager.h \
../Common/KeyMap.h \
- ../Common/MathUtil.h \
../Common/MemArena.h \
../Common/MemoryUtil.h \
../Common/MsgHandler.h \
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index 5a8e9070bf..af38d70650 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -122,7 +122,6 @@ EXEC_AND_LIB_FILES := \
$(SRC)/Common/ThreadPools.cpp \
$(SRC)/Common/Timer.cpp \
$(SRC)/Common/Misc.cpp \
- $(SRC)/Common/MathUtil.cpp \
$(SRC)/GPU/Math3D.cpp \
$(SRC)/GPU/GPUCommon.cpp \
$(SRC)/GPU/GPUState.cpp \