diff --git a/lib/linux64/mathlib.a b/lib/linux64/mathlib.a
index bf68bb79..3c96b54d 100644
Binary files a/lib/linux64/mathlib.a and b/lib/linux64/mathlib.a differ
diff --git a/lib/public/win64/mathlib.lib b/lib/public/win64/mathlib.lib
new file mode 100644
index 00000000..913d2188
Binary files /dev/null and b/lib/public/win64/mathlib.lib differ
diff --git a/linux_sdk/x86-64/Makefile b/linux_sdk/x86-64/Makefile
index 9e7c1bae..94de913a 100644
--- a/linux_sdk/x86-64/Makefile
+++ b/linux_sdk/x86-64/Makefile
@@ -107,7 +107,7 @@ DEFINES += -DCOMPILER_GCC -DPOSIX -DX64BITS -DPLATFORM_64BITS -DVPROF_LEVEL=1 -D
UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
BASE_CFLAGS = -fno-strict-aliasing -Wall -Werror -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof \
- -Wno-unused
+ -Wno-unused -Wno-deprecated-register -Wno-c++11-narrowing
SHLIBCFLAGS = -fPIC
# Clang >= 3 || GCC >= 4.7
diff --git a/mathlib/imagequant.cpp b/mathlib/imagequant.cpp
index ce712427..783ca999 100644
--- a/mathlib/imagequant.cpp
+++ b/mathlib/imagequant.cpp
@@ -57,7 +57,7 @@ void ColorQuantize(uint8 const *Image,
{
struct QuantizedValue *v=FindQNode(q,p);
if (v)
- for(int c=0;c<3;c++)
+ for(c=0;c<3;c++)
out_palette[p*3+c]=v->Mean[c];
}
memset(Error,0,sizeof(Error));
diff --git a/mathlib/mathlib.sln b/mathlib/mathlib.sln
index e478e141..9f64518d 100644
--- a/mathlib/mathlib.sln
+++ b/mathlib/mathlib.sln
@@ -1,18 +1,26 @@
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.7.34031.279
+MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mathlib", "mathlib.vcxproj", "{884C66F2-7F84-4570-AE6C-B634C1113D69}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
+ Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Debug|Win32.ActiveCfg = Debug|Win32
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Debug|Win32.Build.0 = Debug|Win32
+ {884C66F2-7F84-4570-AE6C-B634C1113D69}.Debug|x64.ActiveCfg = Debug|x64
+ {884C66F2-7F84-4570-AE6C-B634C1113D69}.Debug|x64.Build.0 = Debug|x64
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Release|Win32.ActiveCfg = Release|Win32
{884C66F2-7F84-4570-AE6C-B634C1113D69}.Release|Win32.Build.0 = Release|Win32
+ {884C66F2-7F84-4570-AE6C-B634C1113D69}.Release|x64.ActiveCfg = Release|x64
+ {884C66F2-7F84-4570-AE6C-B634C1113D69}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/mathlib/mathlib.vcxproj b/mathlib/mathlib.vcxproj
index 2f4e8490..db305c68 100644
--- a/mathlib/mathlib.vcxproj
+++ b/mathlib/mathlib.vcxproj
@@ -5,42 +5,73 @@
Debug
Win32
+
+ Debug
+ x64
+
Release
Win32
+
+ Release
+ x64
+
{884C66F2-7F84-4570-AE6C-B634C1113D69}
mathlib
+ 10.0
StaticLibrary
+
+ StaticLibrary
+ v140_xp
+
StaticLibrary
+
+ StaticLibrary
+
+
+
+
+
+
+
<_ProjectFileVersion>10.0.40219.1
..\lib\public\
..\lib\public\
AllRules.ruleset
+ AllRules.ruleset
+
+
AllRules.ruleset
+ AllRules.ruleset
+
+
+
+
+ ..\lib\public\win64\
@@ -75,6 +106,38 @@
+
+
+
+
+
+
+ Disabled
+ ..\public;..\public\tier0;..\public\tier1;..\public\mathlib;%(AdditionalIncludeDirectories)
+ _HAS_ITERATOR_DEBUGGING=0;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;WIN32;_WIN32;COMPILER_MSVC;COMPILER_MSVC32;_DEBUG;DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)
+ true
+ false
+ EnableFastChecks
+ MultiThreadedDebug
+ false
+ Fast
+
+
+
+
+
+
+ Level3
+ ProgramDatabase
+
+
+
+
+
+
+
+
+
@@ -110,6 +173,41 @@
+
+
+
+
+
+
+ MaxSpeed
+ AnySuitable
+ true
+ Speed
+ ..\public;..\public\tier0;..\public\tier1;..\public\mathlib;%(AdditionalIncludeDirectories)
+ _HAS_ITERATOR_DEBUGGING=0;_ALLOW_RUNTIME_LIBRARY_MISMATCH;_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH;_ALLOW_MSC_VER_MISMATCH;WIN32;_WIN32;WIN64;_WIN64;COMPILER_MSVC;COMPILER_MSVC64;PLATFORM_64BITS;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)
+ true
+ false
+ MultiThreaded
+ false
+ true
+ Fast
+
+
+
+
+
+
+ Level3
+ OldStyle
+
+
+
+
+
+
+
+
+
diff --git a/mathlib/mathlib_base.cpp b/mathlib/mathlib_base.cpp
index d8068ea6..8d017a4c 100644
--- a/mathlib/mathlib_base.cpp
+++ b/mathlib/mathlib_base.cpp
@@ -3236,6 +3236,7 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
{
s_bSSEEnabled = true;
+#ifndef _WIN64
// Select the SSE specific routines if available
pfVectorNormalizeFast = _SSE_VectorNormalizeFast;
pfInvRSquared = _SSE_InvRSquared;
@@ -3245,6 +3246,7 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
#ifdef _WIN32
pfFastSinCos = _SSE_SinCos;
pfFastCos = _SSE_cos;
+#endif
#endif
}
else
@@ -3255,7 +3257,7 @@ void MathLib_Init( float gamma, float texGamma, float brightness, int overbright
if ( bAllowSSE2 && pi.m_bSSE2 )
{
s_bSSE2Enabled = true;
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(_WIN64)
pfFastSinCos = _SSE2_SinCos;
pfFastCos = _SSE2_cos;
#endif
diff --git a/mathlib/quantize.cpp b/mathlib/quantize.cpp
index 2f4b64f2..aec1a3ce 100644
--- a/mathlib/quantize.cpp
+++ b/mathlib/quantize.cpp
@@ -198,8 +198,8 @@ static void UpdateStats(struct QuantizedValue *v)
N+=s->Count;
for(j=0;jValue[j];
- Means[j]+=v*s->Count;
+ uint8 v2=s->Value[j];
+ Means[j]+=v2*s->Count;
}
}
for(j=0;jValue[i];
LocalMean[i][1]=maxS->Value[i];
diff --git a/public/mathlib/ssemath.h b/public/mathlib/ssemath.h
index ed51693d..72e14ebd 100644
--- a/public/mathlib/ssemath.h
+++ b/public/mathlib/ssemath.h
@@ -2931,6 +2931,12 @@ FORCEINLINE i32x4 IntShiftLeftWordSIMD(const i32x4 &vSrcA, const i32x4 &vSrcB)
// like this.
FORCEINLINE void ConvertStoreAsIntsSIMD(intx4 * RESTRICT pDest, const fltx4 &vSrc)
{
+#ifdef COMPILER_MSVC64
+ (*pDest)[0] = SubFloat(vSrc, 0);
+ (*pDest)[1] = SubFloat(vSrc, 1);
+ (*pDest)[2] = SubFloat(vSrc, 2);
+ (*pDest)[3] = SubFloat(vSrc, 3);
+#else
__m64 bottom = _mm_cvttps_pi32( vSrc );
__m64 top = _mm_cvttps_pi32( _mm_movehl_ps(vSrc,vSrc) );
@@ -2938,6 +2944,7 @@ FORCEINLINE void ConvertStoreAsIntsSIMD(intx4 * RESTRICT pDest, const fltx4 &vSr
*reinterpret_cast<__m64 *>(&(*pDest)[2]) = top;
_mm_empty();
+#endif
}