From: <man...@us...> - 2014-06-10 16:27:49
|
Revision: 4095 http://sourceforge.net/p/modplug/code/4095 Author: manxorist Date: 2014-06-10 16:27:31 +0000 (Tue, 10 Jun 2014) Log Message: ----------- [Ref] Move compiler-/platform-dependent Endianness.h from soundlib/ into common/ . serialization_utils.* and generic endian-safe IO functions will need this. [Fix] Fix some file paths in VS2008 project file. VS2008 decided to reorder configuration sections while at it. Leave it that way in the hope that it does not do this again. [Ref] Only include Endianness.h where needed. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj.filters trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj.filters trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/soundlib/FileReader.h trunk/OpenMPT/soundlib/SampleFormatConverters.h trunk/OpenMPT/soundlib/Wav.h trunk/OpenMPT/soundlib/plugins/PlugInterface.h Added Paths: ----------- trunk/OpenMPT/common/Endianness.h Removed Paths: ------------- trunk/OpenMPT/soundlib/Endianness.h Copied: trunk/OpenMPT/common/Endianness.h (from rev 4094, trunk/OpenMPT/soundlib/Endianness.h) =================================================================== --- trunk/OpenMPT/common/Endianness.h (rev 0) +++ trunk/OpenMPT/common/Endianness.h 2014-06-10 16:27:31 UTC (rev 4095) @@ -0,0 +1,303 @@ +/* + * Endianness.h + * ------------ + * Purpose: Code for deadling with endianness. + * Notes : VC++ didn't like my compile-time endianness check - or rather, it didn't decide at compile time. ;_; + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#pragma once + +OPENMPT_NAMESPACE_BEGIN + +// Ending swaps: +// BigEndian(x) may be used either to: +// -Convert DWORD x, which is in big endian format(for example read from file), +// to endian format of current architecture. +// -Convert value x from endian format of current architecture to big endian format. +// Similarly LittleEndian(x) converts known little endian format to format of current +// endian architecture or value x in format of current architecture to little endian +// format. + +#if MPT_COMPILER_GCC +#if MPT_GCC_AT_LEAST(4,3,0) +#define bswap32 __builtin_bswap32 +#endif +#elif MPT_COMPILER_MSVC +#include <intrin.h> +#define bswap16 _byteswap_ushort +#define bswap32 _byteswap_ulong +#endif + +// No intrinsics available +#ifndef bswap16 +#define bswap16(x) (((x >> 8) & 0xFF) | ((x << 8) & 0xFF00)) +#endif +#ifndef bswap32 +#define bswap32(x) (((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | ((x & 0xFF000000) >> 24)) +#endif + +// Deprecated. Use "SwapBytesXX" versions below. +#ifdef MPT_PLATFORM_BIG_ENDIAN +inline uint32 LittleEndian(uint32 x) { return bswap32(x); } +inline uint16 LittleEndianW(uint16 x) { return bswap16(x); } +#define BigEndian(x) (x) +#define BigEndianW(x) (x) +#else +inline uint32 BigEndian(uint32 x) { return bswap32(x); } +inline uint16 BigEndianW(uint16 x) { return bswap16(x); } +#define LittleEndian(x) (x) +#define LittleEndianW(x) (x) +#endif + +#if defined(MPT_PLATFORM_BIG_ENDIAN) +#define bswap32le(x) bswap32(x) +#define bswap16le(x) bswap16(x) +#define bswap32be(x) (x) +#define bswap16be(x) (x) +#elif defined(MPT_PLATFORM_LITTLE_ENDIAN) +#define bswap32be(x) bswap32(x) +#define bswap16be(x) bswap16(x) +#define bswap32le(x) (x) +#define bswap16le(x) (x) +#endif + +inline uint32 SwapBytesBE_(uint32 value) { return bswap32be(value); } +inline uint16 SwapBytesBE_(uint16 value) { return bswap16be(value); } +inline uint32 SwapBytesLE_(uint32 value) { return bswap32le(value); } +inline uint16 SwapBytesLE_(uint16 value) { return bswap16le(value); } +inline int32 SwapBytesBE_(int32 value) { return bswap32be(value); } +inline int16 SwapBytesBE_(int16 value) { return bswap16be(value); } +inline int32 SwapBytesLE_(int32 value) { return bswap32le(value); } +inline int16 SwapBytesLE_(int16 value) { return bswap16le(value); } + +// Do NOT remove these overloads, even if they seem useless. +// We do not want risking to extend 8bit integers to int and then +// endian-converting and casting back to int. +// Thus these overloads. +inline uint8 SwapBytesLE_(uint8 value) { return value; } +inline int8 SwapBytesLE_(int8 value) { return value; } +inline char SwapBytesLE_(char value) { return value; } +inline uint8 SwapBytesBE_(uint8 value) { return value; } +inline int8 SwapBytesBE_(int8 value) { return value; } +inline char SwapBytesBE_(char value) { return value; } + +// SwapBytesLE/SwapBytesBE is mostly used throughout the code with in-place +// argument-modifying semantics. +// As GCC will not bind references to members of packed structures, +// we implement reference semantics by explicitly assigning to a macro +// argument. + +// In-place modifying version: +#define SwapBytesBE(value) do { (value) = SwapBytesBE_((value)); } while(0) +#define SwapBytesLE(value) do { (value) = SwapBytesLE_((value)); } while(0) + +// Alternative, function-style syntax: +#define SwapBytesReturnBE(value) SwapBytesBE_((value)) +#define SwapBytesReturnLE(value) SwapBytesLE_((value)) + +#undef bswap16le +#undef bswap32le +#undef bswap16be +#undef bswap32be +#undef bswap16 +#undef bswap32 + + +// 1.0f --> 0x3f800000u +static forceinline uint32 EncodeIEEE754binary32(float32 f) +{ +#if MPT_PLATFORM_IEEE_FLOAT + STATIC_ASSERT(sizeof(uint32) == sizeof(float32)); + #if MPT_COMPILER_UNION_TYPE_ALIASES + union { + float32 f; + uint32 i; + } conv; + conv.f = f; + return conv.i; + #else + uint32 i = 0; + std::memcpy(&i, &f, sizeof(float32)); + return i; + #endif +#else + #error "IEEE754 single precision float support is required (for now)" +#endif +} + +// 0x3f800000u --> 1.0f +static forceinline float32 DecodeIEEE754binary32(uint32 i) +{ +#if MPT_PLATFORM_IEEE_FLOAT + STATIC_ASSERT(sizeof(uint32) == sizeof(float32)); + #if MPT_COMPILER_UNION_TYPE_ALIASES + union { + uint32 i; + float32 f; + } conv; + conv.i = i; + return conv.f; + #else + float32 f = 0.0f; + std::memcpy(&f, &i, sizeof(float32)); + return f; + #endif +#else + #error "IEEE754 single precision float support is required (for now)" +#endif +} + + +// template parameters are byte indices corresponding to the individual bytes of iee754 in memory +template<std::size_t hihi, std::size_t hilo, std::size_t lohi, std::size_t lolo> +struct IEEE754binary32Emulated +{ +private: + typedef IEEE754binary32Emulated<hihi,hilo,lohi,lolo> self_t; + uint8 bytes[4]; +public: + forceinline uint8 GetByte(std::size_t i) const + { + return bytes[i]; + } + forceinline IEEE754binary32Emulated() { } + forceinline explicit IEEE754binary32Emulated(float32 f) + { + SetInt32(EncodeIEEE754binary32(f)); + } + // b0...b3 are in memory order, i.e. depend on the endianness of this type + // little endian: (0x00,0x00,0x80,0x3f) + // big endian: (0x3f,0x80,0x00,0x00) + forceinline explicit IEEE754binary32Emulated(uint8 b0, uint8 b1, uint8 b2, uint8 b3) + { + bytes[0] = b0; + bytes[1] = b1; + bytes[2] = b2; + bytes[3] = b3; + } + forceinline operator float32 () const + { + return DecodeIEEE754binary32(GetInt32()); + } + forceinline self_t & SetInt32(uint32 i) + { + bytes[hihi] = static_cast<uint8>(i >> 24); + bytes[hilo] = static_cast<uint8>(i >> 16); + bytes[lohi] = static_cast<uint8>(i >> 8); + bytes[lolo] = static_cast<uint8>(i >> 0); + return *this; + } + forceinline uint32 GetInt32() const + { + return 0u + | (static_cast<uint32>(bytes[hihi]) << 24) + | (static_cast<uint32>(bytes[hilo]) << 16) + | (static_cast<uint32>(bytes[lohi]) << 8) + | (static_cast<uint32>(bytes[lolo]) << 0) + ; + } + forceinline bool operator == (const self_t &cmp) const + { + return true + && bytes[0] == cmp.bytes[0] + && bytes[1] == cmp.bytes[1] + && bytes[2] == cmp.bytes[2] + && bytes[3] == cmp.bytes[3] + ; + } + forceinline bool operator != (const self_t &cmp) const + { + return !(*this == cmp); + } +}; + +#if MPT_PLATFORM_IEEE_FLOAT + +struct IEEE754binary32Native +{ +private: + float32 value; +public: + forceinline uint8 GetByte(std::size_t i) const + { + #if defined(MPT_PLATFORM_LITTLE_ENDIAN) + return static_cast<uint8>(EncodeIEEE754binary32(value) >> (i*8)); + #elif defined(MPT_PLATFORM_BIG_ENDIAN) + return static_cast<uint8>(EncodeIEEE754binary32(value) >> ((4-1-i)*8)); + #else + STATIC_ASSERT(false); + #endif + } + forceinline IEEE754binary32Native() { } + forceinline explicit IEEE754binary32Native(float32 f) + { + value = f; + } + // b0...b3 are in memory order, i.e. depend on the endianness of this type + // little endian: (0x00,0x00,0x80,0x3f) + // big endian: (0x3f,0x80,0x00,0x00) + forceinline explicit IEEE754binary32Native(uint8 b0, uint8 b1, uint8 b2, uint8 b3) + { + #if defined(MPT_PLATFORM_LITTLE_ENDIAN) + value = DecodeIEEE754binary32(0u + | (static_cast<uint32>(b0) << 0) + | (static_cast<uint32>(b1) << 8) + | (static_cast<uint32>(b2) << 16) + | (static_cast<uint32>(b3) << 24) + ); + #elif defined(MPT_PLATFORM_BIG_ENDIAN) + value = DecodeIEEE754binary32(0u + | (static_cast<uint32>(b0) << 24) + | (static_cast<uint32>(b1) << 16) + | (static_cast<uint32>(b2) << 8) + | (static_cast<uint32>(b3) << 0) + ); + #else + STATIC_ASSERT(false); + #endif + } + forceinline operator float32 () const + { + return value; + } + forceinline IEEE754binary32Native & SetInt32(uint32 i) + { + value = DecodeIEEE754binary32(i); + return *this; + } + forceinline uint32 GetInt32() const + { + return EncodeIEEE754binary32(value); + } + forceinline bool operator == (const IEEE754binary32Native &cmp) const + { + return value == cmp.value; + } + forceinline bool operator != (const IEEE754binary32Native &cmp) const + { + return value != cmp.value; + } +}; + +#if defined(MPT_PLATFORM_LITTLE_ENDIAN) +typedef IEEE754binary32Native IEEE754binary32LE; +typedef IEEE754binary32Emulated<0,1,2,3> IEEE754binary32BE; +#elif defined(MPT_PLATFORM_BIG_ENDIAN) +typedef IEEE754binary32Emulated<3,2,1,0> IEEE754binary32LE; +typedef IEEE754binary32Native IEEE754binary32BE; +#endif + +#else // !MPT_PLATFORM_IEEE_FLOAT + +typedef IEEE754binary32Emulated<3,2,1,0> IEEE754binary32LE; +typedef IEEE754binary32Emulated<0,1,2,3> IEEE754binary32BE; + +#endif // MPT_PLATFORM_IEEE_FLOAT + +STATIC_ASSERT(sizeof(IEEE754binary32LE) == 4); +STATIC_ASSERT(sizeof(IEEE754binary32BE) == 4); + +OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj 2014-06-10 16:27:31 UTC (rev 4095) @@ -179,6 +179,7 @@ <ClInclude Include="..\common\AudioCriticalSection.h" /> <ClInclude Include="..\common\BuildSettings.h" /> <ClInclude Include="..\common\CompilerDetect.h" /> + <ClInclude Include="..\common\Endianness.h" /> <ClInclude Include="..\common\FlagSet.h" /> <ClInclude Include="..\common\Logging.h" /> <ClInclude Include="..\common\misc_util.h" /> @@ -200,7 +201,6 @@ <ClInclude Include="..\soundlib\ChunkReader.h" /> <ClInclude Include="..\soundlib\Dither.h" /> <ClInclude Include="..\soundlib\Dlsbank.h" /> - <ClInclude Include="..\soundlib\Endianness.h" /> <ClInclude Include="..\soundlib\FileReader.h" /> <ClInclude Include="..\soundlib\FloatMixer.h" /> <ClInclude Include="..\soundlib\IntMixer.h" /> Modified: trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/libopenmpt/libopenmpt.vcxproj.filters 2014-06-10 16:27:31 UTC (rev 4095) @@ -74,9 +74,6 @@ <ClInclude Include="..\soundlib\Dlsbank.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> - <ClInclude Include="..\soundlib\Endianness.h"> - <Filter>Header Files\soundlib</Filter> - </ClInclude> <ClInclude Include="..\soundlib\FileReader.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> @@ -266,6 +263,9 @@ <ClInclude Include="..\test\TestToolsTracker.h"> <Filter>Header Files\test</Filter> </ClInclude> + <ClInclude Include="..\common\Endianness.h"> + <Filter>Header Files\common</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="..\common\AudioCriticalSection.cpp"> Modified: trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj 2014-06-10 16:27:31 UTC (rev 4095) @@ -187,6 +187,7 @@ <ClInclude Include="..\common\AudioCriticalSection.h" /> <ClInclude Include="..\common\BuildSettings.h" /> <ClInclude Include="..\common\CompilerDetect.h" /> + <ClInclude Include="..\common\Endianness.h" /> <ClInclude Include="..\common\FlagSet.h" /> <ClInclude Include="..\common\Logging.h" /> <ClInclude Include="..\common\misc_util.h" /> @@ -208,7 +209,6 @@ <ClInclude Include="..\soundlib\ChunkReader.h" /> <ClInclude Include="..\soundlib\Dither.h" /> <ClInclude Include="..\soundlib\Dlsbank.h" /> - <ClInclude Include="..\soundlib\Endianness.h" /> <ClInclude Include="..\soundlib\FileReader.h" /> <ClInclude Include="..\soundlib\FloatMixer.h" /> <ClInclude Include="..\soundlib\IntMixer.h" /> Modified: trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj.filters 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/libopenmpt/libopenmptDLL.vcxproj.filters 2014-06-10 16:27:31 UTC (rev 4095) @@ -74,9 +74,6 @@ <ClInclude Include="..\soundlib\Dlsbank.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> - <ClInclude Include="..\soundlib\Endianness.h"> - <Filter>Header Files\soundlib</Filter> - </ClInclude> <ClInclude Include="..\soundlib\FileReader.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> @@ -272,6 +269,9 @@ <ClInclude Include="..\test\TestToolsTracker.h"> <Filter>Header Files\test</Filter> </ClInclude> + <ClInclude Include="..\common\Endianness.h"> + <Filter>Header Files\common</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="..\common\AudioCriticalSection.cpp"> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj 2014-06-10 16:27:31 UTC (rev 4095) @@ -183,6 +183,7 @@ <ClInclude Include="..\common\AudioCriticalSection.h" /> <ClInclude Include="..\common\BuildSettings.h" /> <ClInclude Include="..\common\CompilerDetect.h" /> + <ClInclude Include="..\common\Endianness.h" /> <ClInclude Include="..\common\FlagSet.h" /> <ClInclude Include="..\common\Logging.h" /> <ClInclude Include="..\common\misc_util.h" /> @@ -204,7 +205,6 @@ <ClInclude Include="..\soundlib\ChunkReader.h" /> <ClInclude Include="..\soundlib\Dither.h" /> <ClInclude Include="..\soundlib\Dlsbank.h" /> - <ClInclude Include="..\soundlib\Endianness.h" /> <ClInclude Include="..\soundlib\FileReader.h" /> <ClInclude Include="..\soundlib\FloatMixer.h" /> <ClInclude Include="..\soundlib\IntMixer.h" /> Modified: trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj.filters =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj.filters 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/libopenmpt/libopenmpt_test.vcxproj.filters 2014-06-10 16:27:31 UTC (rev 4095) @@ -74,9 +74,6 @@ <ClInclude Include="..\soundlib\Dlsbank.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> - <ClInclude Include="..\soundlib\Endianness.h"> - <Filter>Header Files\soundlib</Filter> - </ClInclude> <ClInclude Include="..\soundlib\FileReader.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> @@ -266,6 +263,9 @@ <ClInclude Include="..\test\TestToolsTracker.h"> <Filter>Header Files\test</Filter> </ClInclude> + <ClInclude Include="..\common\Endianness.h"> + <Filter>Header Files\common</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ClCompile Include="..\common\AudioCriticalSection.cpp"> Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-06-10 16:27:31 UTC (rev 4095) @@ -120,14 +120,13 @@ /> </Configuration> <Configuration - Name="Release|Win32" - OutputDirectory="..\bin\$(PlatformName)\" - IntermediateDirectory="..\build\obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)" + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="1" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - UseOfMFC="1" + UseOfMFC="2" ATLMinimizesCRunTimeLibraryUsage="false" - WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" @@ -144,26 +143,27 @@ /> <Tool Name="VCMIDLTool" - PreprocessorDefinitions="NDEBUG" + PreprocessorDefinitions="_DEBUG" MkTypLibCompatible="true" SuppressStartupBanner="true" - TargetEnvironment="1" - TypeLibraryName=".\Bin/mptrack.tlb" + TargetEnvironment="3" + TypeLibraryName=".\Debug/mptrack.tlb" /> <Tool Name="VCCLCompilerTool" - Optimization="2" - InlineFunctionExpansion="2" + Optimization="0" AdditionalIncludeDirectories="..\common;..\soundlib;..\include\msinttypes\stdint;..\include\msinttypes\inttypes;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\include\lhasa\lib\public;..\include\zlib;..\;..\mptrack\svn_version;..\common\svn_version_default" - PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,MODPLUG_TRACKER" + PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,MODPLUG_TRACKER" StringPooling="true" ExceptionHandling="2" - RuntimeLibrary="0" + BasicRuntimeChecks="3" + RuntimeLibrary="3" BufferSecurityCheck="true" - EnableFunctionLevelLinking="false" + EnableFunctionLevelLinking="true" UsePrecompiledHeader="2" PrecompiledHeaderThrough="stdafx.h" - WarningLevel="3" + BrowseInformation="1" + WarningLevel="4" SuppressStartupBanner="false" DebugInformationFormat="3" CompileAs="0" @@ -173,7 +173,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="NDEBUG" + PreprocessorDefinitions="_DEBUG" Culture="1033" /> <Tool @@ -181,20 +181,20 @@ /> <Tool Name="VCLinkerTool" - AdditionalOptions="/MACHINE:I386" - AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib wininet.lib dsound.lib msacm32.lib ksguid.lib ksuser.lib htmlhelp.lib" + AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib dsound.lib msacm32.lib ksguid.lib ksuser.lib htmlhelp.lib" Version="5.0" - LinkIncremental="1" + LinkIncremental="2" SuppressStartupBanner="true" AdditionalLibraryDirectories="" DelayLoadDLLs="OpenMPT_SoundTouch_f32.dll" GenerateDebugInformation="true" + AssemblyDebug="1" + GenerateMapFile="true" SubSystem="2" LargeAddressAware="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - RandomizedBaseAddress="2" + RandomizedBaseAddress="1" DataExecutionPrevention="0" + TargetMachine="17" /> <Tool Name="VCALinkTool" @@ -220,13 +220,14 @@ /> </Configuration> <Configuration - Name="Debug|x64" - OutputDirectory="$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + Name="Release|Win32" + OutputDirectory="..\bin\$(PlatformName)\" + IntermediateDirectory="..\build\obj\$(ProjectName)\$(PlatformName)\$(ConfigurationName)" ConfigurationType="1" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" - UseOfMFC="2" + UseOfMFC="1" ATLMinimizesCRunTimeLibraryUsage="false" + WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" @@ -243,27 +244,26 @@ /> <Tool Name="VCMIDLTool" - PreprocessorDefinitions="_DEBUG" + PreprocessorDefinitions="NDEBUG" MkTypLibCompatible="true" SuppressStartupBanner="true" - TargetEnvironment="3" - TypeLibraryName=".\Debug/mptrack.tlb" + TargetEnvironment="1" + TypeLibraryName=".\Bin/mptrack.tlb" /> <Tool Name="VCCLCompilerTool" - Optimization="0" + Optimization="2" + InlineFunctionExpansion="2" AdditionalIncludeDirectories="..\common;..\soundlib;..\include\msinttypes\stdint;..\include\msinttypes\inttypes;..\include;..\include\vstsdk2.4\;..\include\ASIOSDK2\common\;..\include\lhasa\lib\public;..\include\zlib;..\;..\mptrack\svn_version;..\common\svn_version_default" - PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,MODPLUG_TRACKER" + PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,MODPLUG_TRACKER" StringPooling="true" ExceptionHandling="2" - BasicRuntimeChecks="3" - RuntimeLibrary="3" + RuntimeLibrary="0" BufferSecurityCheck="true" - EnableFunctionLevelLinking="true" + EnableFunctionLevelLinking="false" UsePrecompiledHeader="2" PrecompiledHeaderThrough="stdafx.h" - BrowseInformation="1" - WarningLevel="4" + WarningLevel="3" SuppressStartupBanner="false" DebugInformationFormat="3" CompileAs="0" @@ -273,7 +273,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="_DEBUG" + PreprocessorDefinitions="NDEBUG" Culture="1033" /> <Tool @@ -281,20 +281,20 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib dsound.lib msacm32.lib ksguid.lib ksuser.lib htmlhelp.lib" + AdditionalOptions="/MACHINE:I386" + AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib wininet.lib dsound.lib msacm32.lib ksguid.lib ksuser.lib htmlhelp.lib" Version="5.0" - LinkIncremental="2" + LinkIncremental="1" SuppressStartupBanner="true" AdditionalLibraryDirectories="" DelayLoadDLLs="OpenMPT_SoundTouch_f32.dll" GenerateDebugInformation="true" - AssemblyDebug="1" - GenerateMapFile="true" SubSystem="2" LargeAddressAware="2" - RandomizedBaseAddress="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + RandomizedBaseAddress="2" DataExecutionPrevention="0" - TargetMachine="17" /> <Tool Name="VCALinkTool" @@ -791,7 +791,7 @@ /> </FileConfiguration> <FileConfiguration - Name="Release|Win32" + Name="Debug|x64" > <Tool Name="VCCLCompilerTool" @@ -799,7 +799,7 @@ /> </FileConfiguration> <FileConfiguration - Name="Debug|x64" + Name="Release|Win32" > <Tool Name="VCCLCompilerTool" @@ -1037,11 +1037,11 @@ > </File> <File - RelativePath=".\res\mptrack.png" + RelativePath=".\res\mptrack.ico" > </File> <File - RelativePath=".\res\mptrack.ico" + RelativePath=".\res\mptrack.png" > </File> <File @@ -1138,6 +1138,10 @@ > </File> <File + RelativePath=".\CImageListEx.h" + > + </File> + <File RelativePath=".\CleanupSong.h" > </File> @@ -1162,10 +1166,6 @@ > </File> <File - RelativePath=".\CImageListEx.h" - > - </File> - <File RelativePath=".\ctrl_com.h" > </File> @@ -1206,7 +1206,7 @@ > </File> <File - RelativePath="..\soundlib\Endianness.h" + RelativePath="..\common\Endianness.h" > </File> <File @@ -1382,19 +1382,19 @@ > </File> <File - RelativePath=".\PNG.h" + RelativePath="..\soundlib\plugins\PluginEventQueue.h" > </File> <File - RelativePath=".\soundlib\plugins\PluginEventQueue.h" + RelativePath="..\soundlib\plugins\PluginMixBuffer.h" > </File> <File - RelativePath=".\soundlib\plugins\PluginMixBuffer.h" + RelativePath="..\soundlib\plugins\PlugInterface.h" > </File> <File - RelativePath=".\soundlib\plugins\PlugInterface.h" + RelativePath=".\PNG.h" > </File> <File @@ -1514,11 +1514,11 @@ > </File> <File - RelativePath=".\svn_version\svn_version.h" + RelativePath="..\common\svn_version_default\svn_version.h" > </File> <File - RelativePath="..\common\svn_version_default\svn_version.h" + RelativePath=".\svn_version\svn_version.h" > </File> <File Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-06-10 16:27:31 UTC (rev 4095) @@ -642,6 +642,7 @@ <ClInclude Include="..\common\AudioCriticalSection.h" /> <ClInclude Include="..\common\BuildSettings.h" /> <ClInclude Include="..\common\CompilerDetect.h" /> + <ClInclude Include="..\common\Endianness.h" /> <ClInclude Include="..\common\FlagSet.h" /> <ClInclude Include="..\common\Logging.h" /> <ClInclude Include="..\common\misc_util.h" /> @@ -674,7 +675,6 @@ <ClInclude Include="..\soundlib\ChunkReader.h" /> <ClInclude Include="..\soundlib\Dither.h" /> <ClInclude Include="..\soundlib\Dlsbank.h" /> - <ClInclude Include="..\soundlib\Endianness.h" /> <ClInclude Include="..\soundlib\FileReader.h" /> <ClInclude Include="..\soundlib\FloatMixer.h" /> <ClInclude Include="..\soundlib\IntMixer.h" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-06-10 16:27:31 UTC (rev 4095) @@ -630,9 +630,6 @@ <ClInclude Include="..\soundlib\WindowedFIR.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> - <ClInclude Include="..\soundlib\Endianness.h"> - <Filter>Header Files\soundlib</Filter> - </ClInclude> <ClInclude Include="..\soundlib\ITCompression.h"> <Filter>Header Files\soundlib</Filter> </ClInclude> @@ -1020,6 +1017,9 @@ <ClInclude Include="AboutDialog.h"> <Filter>Header Files\mptrack\Dialogs</Filter> </ClInclude> + <ClInclude Include="..\common\Endianness.h"> + <Filter>Header Files\common</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> Deleted: trunk/OpenMPT/soundlib/Endianness.h =================================================================== --- trunk/OpenMPT/soundlib/Endianness.h 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/soundlib/Endianness.h 2014-06-10 16:27:31 UTC (rev 4095) @@ -1,303 +0,0 @@ -/* - * Endianness.h - * ------------ - * Purpose: Code for deadling with endianness. - * Notes : VC++ didn't like my compile-time endianness check - or rather, it didn't decide at compile time. ;_; - * Authors: OpenMPT Devs - * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. - */ - - -#pragma once - -OPENMPT_NAMESPACE_BEGIN - -// Ending swaps: -// BigEndian(x) may be used either to: -// -Convert DWORD x, which is in big endian format(for example read from file), -// to endian format of current architecture. -// -Convert value x from endian format of current architecture to big endian format. -// Similarly LittleEndian(x) converts known little endian format to format of current -// endian architecture or value x in format of current architecture to little endian -// format. - -#if MPT_COMPILER_GCC -#if MPT_GCC_AT_LEAST(4,3,0) -#define bswap32 __builtin_bswap32 -#endif -#elif MPT_COMPILER_MSVC -#include <intrin.h> -#define bswap16 _byteswap_ushort -#define bswap32 _byteswap_ulong -#endif - -// No intrinsics available -#ifndef bswap16 -#define bswap16(x) (((x >> 8) & 0xFF) | ((x << 8) & 0xFF00)) -#endif -#ifndef bswap32 -#define bswap32(x) (((x & 0xFF) << 24) | ((x & 0xFF00) << 8) | ((x & 0xFF0000) >> 8) | ((x & 0xFF000000) >> 24)) -#endif - -// Deprecated. Use "SwapBytesXX" versions below. -#ifdef MPT_PLATFORM_BIG_ENDIAN -inline uint32 LittleEndian(uint32 x) { return bswap32(x); } -inline uint16 LittleEndianW(uint16 x) { return bswap16(x); } -#define BigEndian(x) (x) -#define BigEndianW(x) (x) -#else -inline uint32 BigEndian(uint32 x) { return bswap32(x); } -inline uint16 BigEndianW(uint16 x) { return bswap16(x); } -#define LittleEndian(x) (x) -#define LittleEndianW(x) (x) -#endif - -#if defined(MPT_PLATFORM_BIG_ENDIAN) -#define bswap32le(x) bswap32(x) -#define bswap16le(x) bswap16(x) -#define bswap32be(x) (x) -#define bswap16be(x) (x) -#elif defined(MPT_PLATFORM_LITTLE_ENDIAN) -#define bswap32be(x) bswap32(x) -#define bswap16be(x) bswap16(x) -#define bswap32le(x) (x) -#define bswap16le(x) (x) -#endif - -inline uint32 SwapBytesBE_(uint32 value) { return bswap32be(value); } -inline uint16 SwapBytesBE_(uint16 value) { return bswap16be(value); } -inline uint32 SwapBytesLE_(uint32 value) { return bswap32le(value); } -inline uint16 SwapBytesLE_(uint16 value) { return bswap16le(value); } -inline int32 SwapBytesBE_(int32 value) { return bswap32be(value); } -inline int16 SwapBytesBE_(int16 value) { return bswap16be(value); } -inline int32 SwapBytesLE_(int32 value) { return bswap32le(value); } -inline int16 SwapBytesLE_(int16 value) { return bswap16le(value); } - -// Do NOT remove these overloads, even if they seem useless. -// We do not want risking to extend 8bit integers to int and then -// endian-converting and casting back to int. -// Thus these overloads. -inline uint8 SwapBytesLE_(uint8 value) { return value; } -inline int8 SwapBytesLE_(int8 value) { return value; } -inline char SwapBytesLE_(char value) { return value; } -inline uint8 SwapBytesBE_(uint8 value) { return value; } -inline int8 SwapBytesBE_(int8 value) { return value; } -inline char SwapBytesBE_(char value) { return value; } - -// SwapBytesLE/SwapBytesBE is mostly used throughout the code with in-place -// argument-modifying semantics. -// As GCC will not bind references to members of packed structures, -// we implement reference semantics by explicitly assigning to a macro -// argument. - -// In-place modifying version: -#define SwapBytesBE(value) do { (value) = SwapBytesBE_((value)); } while(0) -#define SwapBytesLE(value) do { (value) = SwapBytesLE_((value)); } while(0) - -// Alternative, function-style syntax: -#define SwapBytesReturnBE(value) SwapBytesBE_((value)) -#define SwapBytesReturnLE(value) SwapBytesLE_((value)) - -#undef bswap16le -#undef bswap32le -#undef bswap16be -#undef bswap32be -#undef bswap16 -#undef bswap32 - - -// 1.0f --> 0x3f800000u -static forceinline uint32 EncodeIEEE754binary32(float32 f) -{ -#if MPT_PLATFORM_IEEE_FLOAT - STATIC_ASSERT(sizeof(uint32) == sizeof(float32)); - #if MPT_COMPILER_UNION_TYPE_ALIASES - union { - float32 f; - uint32 i; - } conv; - conv.f = f; - return conv.i; - #else - uint32 i = 0; - std::memcpy(&i, &f, sizeof(float32)); - return i; - #endif -#else - #error "IEEE754 single precision float support is required (for now)" -#endif -} - -// 0x3f800000u --> 1.0f -static forceinline float32 DecodeIEEE754binary32(uint32 i) -{ -#if MPT_PLATFORM_IEEE_FLOAT - STATIC_ASSERT(sizeof(uint32) == sizeof(float32)); - #if MPT_COMPILER_UNION_TYPE_ALIASES - union { - uint32 i; - float32 f; - } conv; - conv.i = i; - return conv.f; - #else - float32 f = 0.0f; - std::memcpy(&f, &i, sizeof(float32)); - return f; - #endif -#else - #error "IEEE754 single precision float support is required (for now)" -#endif -} - - -// template parameters are byte indices corresponding to the individual bytes of iee754 in memory -template<std::size_t hihi, std::size_t hilo, std::size_t lohi, std::size_t lolo> -struct IEEE754binary32Emulated -{ -private: - typedef IEEE754binary32Emulated<hihi,hilo,lohi,lolo> self_t; - uint8 bytes[4]; -public: - forceinline uint8 GetByte(std::size_t i) const - { - return bytes[i]; - } - forceinline IEEE754binary32Emulated() { } - forceinline explicit IEEE754binary32Emulated(float32 f) - { - SetInt32(EncodeIEEE754binary32(f)); - } - // b0...b3 are in memory order, i.e. depend on the endianness of this type - // little endian: (0x00,0x00,0x80,0x3f) - // big endian: (0x3f,0x80,0x00,0x00) - forceinline explicit IEEE754binary32Emulated(uint8 b0, uint8 b1, uint8 b2, uint8 b3) - { - bytes[0] = b0; - bytes[1] = b1; - bytes[2] = b2; - bytes[3] = b3; - } - forceinline operator float32 () const - { - return DecodeIEEE754binary32(GetInt32()); - } - forceinline self_t & SetInt32(uint32 i) - { - bytes[hihi] = static_cast<uint8>(i >> 24); - bytes[hilo] = static_cast<uint8>(i >> 16); - bytes[lohi] = static_cast<uint8>(i >> 8); - bytes[lolo] = static_cast<uint8>(i >> 0); - return *this; - } - forceinline uint32 GetInt32() const - { - return 0u - | (static_cast<uint32>(bytes[hihi]) << 24) - | (static_cast<uint32>(bytes[hilo]) << 16) - | (static_cast<uint32>(bytes[lohi]) << 8) - | (static_cast<uint32>(bytes[lolo]) << 0) - ; - } - forceinline bool operator == (const self_t &cmp) const - { - return true - && bytes[0] == cmp.bytes[0] - && bytes[1] == cmp.bytes[1] - && bytes[2] == cmp.bytes[2] - && bytes[3] == cmp.bytes[3] - ; - } - forceinline bool operator != (const self_t &cmp) const - { - return !(*this == cmp); - } -}; - -#if MPT_PLATFORM_IEEE_FLOAT - -struct IEEE754binary32Native -{ -private: - float32 value; -public: - forceinline uint8 GetByte(std::size_t i) const - { - #if defined(MPT_PLATFORM_LITTLE_ENDIAN) - return static_cast<uint8>(EncodeIEEE754binary32(value) >> (i*8)); - #elif defined(MPT_PLATFORM_BIG_ENDIAN) - return static_cast<uint8>(EncodeIEEE754binary32(value) >> ((4-1-i)*8)); - #else - STATIC_ASSERT(false); - #endif - } - forceinline IEEE754binary32Native() { } - forceinline explicit IEEE754binary32Native(float32 f) - { - value = f; - } - // b0...b3 are in memory order, i.e. depend on the endianness of this type - // little endian: (0x00,0x00,0x80,0x3f) - // big endian: (0x3f,0x80,0x00,0x00) - forceinline explicit IEEE754binary32Native(uint8 b0, uint8 b1, uint8 b2, uint8 b3) - { - #if defined(MPT_PLATFORM_LITTLE_ENDIAN) - value = DecodeIEEE754binary32(0u - | (static_cast<uint32>(b0) << 0) - | (static_cast<uint32>(b1) << 8) - | (static_cast<uint32>(b2) << 16) - | (static_cast<uint32>(b3) << 24) - ); - #elif defined(MPT_PLATFORM_BIG_ENDIAN) - value = DecodeIEEE754binary32(0u - | (static_cast<uint32>(b0) << 24) - | (static_cast<uint32>(b1) << 16) - | (static_cast<uint32>(b2) << 8) - | (static_cast<uint32>(b3) << 0) - ); - #else - STATIC_ASSERT(false); - #endif - } - forceinline operator float32 () const - { - return value; - } - forceinline IEEE754binary32Native & SetInt32(uint32 i) - { - value = DecodeIEEE754binary32(i); - return *this; - } - forceinline uint32 GetInt32() const - { - return EncodeIEEE754binary32(value); - } - forceinline bool operator == (const IEEE754binary32Native &cmp) const - { - return value == cmp.value; - } - forceinline bool operator != (const IEEE754binary32Native &cmp) const - { - return value != cmp.value; - } -}; - -#if defined(MPT_PLATFORM_LITTLE_ENDIAN) -typedef IEEE754binary32Native IEEE754binary32LE; -typedef IEEE754binary32Emulated<0,1,2,3> IEEE754binary32BE; -#elif defined(MPT_PLATFORM_BIG_ENDIAN) -typedef IEEE754binary32Emulated<3,2,1,0> IEEE754binary32LE; -typedef IEEE754binary32Native IEEE754binary32BE; -#endif - -#else // !MPT_PLATFORM_IEEE_FLOAT - -typedef IEEE754binary32Emulated<3,2,1,0> IEEE754binary32LE; -typedef IEEE754binary32Emulated<0,1,2,3> IEEE754binary32BE; - -#endif // MPT_PLATFORM_IEEE_FLOAT - -STATIC_ASSERT(sizeof(IEEE754binary32LE) == 4); -STATIC_ASSERT(sizeof(IEEE754binary32BE) == 4); - -OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/soundlib/FileReader.h =================================================================== --- trunk/OpenMPT/soundlib/FileReader.h 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/soundlib/FileReader.h 2014-06-10 16:27:31 UTC (rev 4095) @@ -14,7 +14,7 @@ #include "../common/typedefs.h" #include "../common/StringFixer.h" #include "../common/misc_util.h" -#include "Endianness.h" +#include "../common/Endianness.h" #include <algorithm> #ifndef NO_FILEREADER_STD_ISTREAM #include <ios> Modified: trunk/OpenMPT/soundlib/SampleFormatConverters.h =================================================================== --- trunk/OpenMPT/soundlib/SampleFormatConverters.h 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/soundlib/SampleFormatConverters.h 2014-06-10 16:27:31 UTC (rev 4095) @@ -10,9 +10,7 @@ #pragma once -#include "../soundlib/Endianness.h" - OPENMPT_NAMESPACE_BEGIN Modified: trunk/OpenMPT/soundlib/Wav.h =================================================================== --- trunk/OpenMPT/soundlib/Wav.h 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/soundlib/Wav.h 2014-06-10 16:27:31 UTC (rev 4095) @@ -10,9 +10,7 @@ #pragma once -#include "Endianness.h" - OPENMPT_NAMESPACE_BEGIN Modified: trunk/OpenMPT/soundlib/plugins/PlugInterface.h =================================================================== --- trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2014-06-10 10:59:09 UTC (rev 4094) +++ trunk/OpenMPT/soundlib/plugins/PlugInterface.h 2014-06-10 16:27:31 UTC (rev 4095) @@ -22,7 +22,7 @@ #include "../../soundlib/Snd_defs.h" #include "../../common/misc_util.h" #include "../../soundlib/MIDIEvents.h" -#include "../../soundlib/Endianness.h" +#include "../../common/Endianness.h" #include "../../soundlib/Mixer.h" OPENMPT_NAMESPACE_BEGIN This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |