Finish getting rid of basictypes.h

This commit is contained in:
Henrik Rydgård 2020-09-29 12:53:18 +02:00
parent 3162f30158
commit 40ec0d8358
18 changed files with 57 additions and 56 deletions

View File

@ -427,8 +427,6 @@ add_library(Common STATIC
${CommonFake}
${CommonWindows}
${CommonVulkan}
Common/ColorConv.cpp
Common/ColorConv.h
Common/Serialize/Serializer.cpp
Common/Serialize/Serializer.h
Common/Serialize/SerializeDeque.h
@ -436,14 +434,26 @@ add_library(Common STATIC
Common/Serialize/SerializeList.h
Common/Serialize/SerializeMap.h
Common/Serialize/SerializeSet.h
Common/ConsoleListener.cpp
Common/ConsoleListener.h
Common/Crypto/md5.cpp
Common/Crypto/md5.h
Common/Crypto/sha1.cpp
Common/Crypto/sha1.h
Common/Crypto/sha256.cpp
Common/Crypto/sha256.h
Common/BitScan.h
Common/BitSet.h
Common/ByteSwap.h
Common/CodeBlock.h
Common/ColorConv.cpp
Common/ColorConv.h
Common/Common.h
Common/CommonFuncs.h
Common/CommonTypes.h
Common/ConsoleListener.cpp
Common/ConsoleListener.h
Common/DbgNew.h
Common/FakeEmitter.h
Common/FixedSizeQueue.h
Common/ExceptionHandlerSetup.cpp
Common/ExceptionHandlerSetup.h
Common/FileUtil.cpp
@ -939,7 +949,6 @@ endif()
add_library(native STATIC
${nativeExtra}
ext/native/base/basictypes.h
ext/native/base/buffer.cpp
ext/native/base/buffer.h
ext/native/base/colorutil.cpp

29
Common/ByteSwap.h Normal file
View File

@ -0,0 +1,29 @@
#pragma once
#include <cstdint>
#include <cstdlib> // for byte swapping
// Byteswapping
// Just in case this has been defined by platform
#undef swap16
#undef swap32
#undef swap64
#ifdef _WIN32
inline uint16_t swap16(uint16_t _data) { return _byteswap_ushort(_data); }
inline uint32_t swap32(uint32_t _data) { return _byteswap_ulong(_data); }
inline uint64_t swap64(uint64_t _data) { return _byteswap_uint64(_data); }
#elif defined(__GNUC__)
inline uint16_t swap16(uint16_t _data) { return __builtin_bswap16(_data); }
inline uint32_t swap32(uint32_t _data) { return __builtin_bswap32(_data); }
inline uint64_t swap64(uint64_t _data) { return __builtin_bswap64(_data); }
#else
// Slow generic implementation. Hopefully this never hits
inline uint16_t swap16(uint16_t data) { return (data >> 8) | (data << 8); }
inline uint32_t swap32(uint32_t data) { return (swap16(data) << 16) | swap16(data >> 16); }
inline uint64_t swap64(uint64_t data) { return ((uint64_t)swap32(data) << 32) | swap32(data >> 32); }
#endif
inline uint16_t swap16(const uint8_t* _pData) { return swap16(*(const uint16_t*)_pData); }
inline uint32_t swap32(const uint8_t* _pData) { return swap32(*(const uint32_t*)_pData); }
inline uint64_t swap64(const uint8_t* _pData) { return swap64(*(const uint64_t*)_pData); }

View File

@ -354,6 +354,7 @@
<ClInclude Include="ArmEmitter.h" />
<ClInclude Include="BitScan.h" />
<ClInclude Include="BitSet.h" />
<ClInclude Include="ByteSwap.h" />
<ClInclude Include="FakeEmitter.h" />
<ClInclude Include="Serialize\SerializeDeque.h" />
<ClInclude Include="Serialize\SerializeFuncs.h" />

View File

@ -94,6 +94,7 @@
</ClInclude>
<ClInclude Include="TimeUtil.h" />
<ClInclude Include="FakeEmitter.h" />
<ClInclude Include="ByteSwap.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp" />

View File

@ -15,9 +15,9 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <cmemory>
#include <cstdint>
#include <memory.h>
#include "base/basictypes.h"
#include "Common.h"
#include "CPUDetect.h"
#include "StringUtils.h"

View File

@ -2,7 +2,7 @@
#include <cstring>
#include <utility>
#include "base/basictypes.h"
#include "Common/ByteSwap.h"
#include "Common/Log.h"
#include "Core/MIPS/IR/IRInterpreter.h"
#include "Core/MIPS/IR/IRPassSimplify.h"

View File

@ -7,8 +7,6 @@
#include <vector>
#include "Common/CommonTypes.h"
// This has to be before basictypes to avoid a define conflict.
#include "ext/armips/Core/Assembler.h"
#include "util/text/utf8.h"

View File

@ -18,13 +18,13 @@
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "base/basictypes.h"
#include <algorithm>
#include "Common/ByteSwap.h"
#include "Common/Common.h"
#include "Core/MIPS/MIPSCodeUtils.h"
#include "Core/MIPS/x86/Jit.h"
#include "Core/MIPS/x86/RegCache.h"
#include <algorithm>
using namespace MIPSAnalyst;

View File

@ -383,7 +383,9 @@
<ClInclude Include="..\..\Common\Arm64Emitter.h" />
<ClInclude Include="..\..\Common\ArmCommon.h" />
<ClInclude Include="..\..\Common\ArmEmitter.h" />
<ClInclude Include="..\..\Common\BitScan.h" />
<ClInclude Include="..\..\Common\BitSet.h" />
<ClInclude Include="..\..\Common\ByteSwap.h" />
<ClInclude Include="..\..\Common\Serialize\Serializer.h" />
<ClInclude Include="..\..\Common\Serialize\SerializeDeque.h" />
<ClInclude Include="..\..\Common\Serialize\SerializeFuncs.h" />

View File

@ -56,6 +56,8 @@
<ClInclude Include="..\..\Common\ArmCommon.h" />
<ClInclude Include="..\..\Common\ArmEmitter.h" />
<ClInclude Include="..\..\Common\BitSet.h" />
<ClInclude Include="..\..\Common\BitScan.h" />
<ClInclude Include="..\..\Common\ByteSwap.h" />
<ClInclude Include="..\..\Common\Serialize\Serializer.h" />
<ClInclude Include="..\..\Common\Serialize\SerializerDeque.h" />
<ClInclude Include="..\..\Common\Serialize\SerializerFuncs.h" />

View File

@ -379,7 +379,6 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\ext\native\base\basictypes.h" />
<ClInclude Include="..\..\ext\native\base\buffer.h" />
<ClInclude Include="..\..\ext\native\base\colorutil.h" />
<ClInclude Include="..\..\ext\native\base\display.h" />

View File

@ -463,9 +463,6 @@
<ItemGroup>
<ClInclude Include="pch.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="..\..\ext\native\base\basictypes.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\..\ext\native\base\buffer.h">
<Filter>base</Filter>
</ClInclude>

View File

@ -49,7 +49,6 @@ struct JNIEnv {};
#define JNI_VERSION_1_6 16
#endif
#include "base/basictypes.h"
#include "base/display.h"
#include "base/NativeApp.h"
#include "thread/threadutil.h"

View File

@ -1,29 +0,0 @@
#pragma once
#include <cstdint>
#include <cstdlib> // for byte swapping
// Byteswapping
// Just in case this has been defined by platform
#undef swap16
#undef swap32
#undef swap64
#ifdef _WIN32
inline uint16_t swap16(uint16_t _data) {return _byteswap_ushort(_data);}
inline uint32_t swap32(uint32_t _data) {return _byteswap_ulong (_data);}
inline uint64_t swap64(uint64_t _data) {return _byteswap_uint64(_data);}
#elif defined(__GNUC__)
inline uint16_t swap16(uint16_t _data) {return __builtin_bswap16(_data);}
inline uint32_t swap32(uint32_t _data) {return __builtin_bswap32(_data);}
inline uint64_t swap64(uint64_t _data) {return __builtin_bswap64(_data);}
#else
// Slow generic implementation. Hopefully this never hits
inline uint16_t swap16(uint16_t data) {return (data >> 8) | (data << 8);}
inline uint32_t swap32(uint32_t data) {return (swap16(data) << 16) | swap16(data >> 16);}
inline uint64_t swap64(uint64_t data) {return ((uint64_t)swap32(data) << 32) | swap32(data >> 32);}
#endif
inline uint16_t swap16(const uint8_t* _pData) {return swap16(*(const uint16_t*)_pData);}
inline uint32_t swap32(const uint8_t* _pData) {return swap32(*(const uint32_t*)_pData);}
inline uint64_t swap64(const uint8_t* _pData) {return swap64(*(const uint64_t*)_pData);}

View File

@ -382,7 +382,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Qt\QtMain.h" />
<ClInclude Include="base\basictypes.h" />
<ClInclude Include="base\buffer.h" />
<ClInclude Include="base\colorutil.h" />
<ClInclude Include="base\display.h" />

View File

@ -68,9 +68,6 @@
<ClInclude Include="file\zip_read.h">
<Filter>file</Filter>
</ClInclude>
<ClInclude Include="base\basictypes.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="gfx\texture_atlas.h">
<Filter>gfx</Filter>
</ClInclude>

View File

@ -1,10 +1,7 @@
#ifndef _UTIL_HASH_HASH_H
#define _UTIL_HASH_HASH_H
#pragma once
#include <cstdlib>
#include "base/basictypes.h"
namespace hash {
// Fairly decent function for hashing strings.
@ -12,4 +9,3 @@ uint32_t Adler32(const uint8_t *data, size_t len);
} // namespace hash
#endif

View File

@ -1,7 +1,8 @@
#pragma once
#include <cstdint>
#include "base/basictypes.h"
#include "Common/ByteSwap.h"
// Should optimize out.
#define UTF16_IS_LITTLE_ENDIAN (*(const uint16_t *)"\0\xff" >= 0x100)