Browse Source

readd sparsepp in new version

tempestpy_adaptions
dehnert 8 years ago
parent
commit
4c3a409961
  1. 47
      resources/3rdparty/sparsepp/.gitignore
  2. 14
      resources/3rdparty/sparsepp/.travis.yml
  3. 16
      resources/3rdparty/sparsepp/CHANGELOG.md
  4. 0
      resources/3rdparty/sparsepp/LICENSE
  5. 14
      resources/3rdparty/sparsepp/README.md
  6. 0
      resources/3rdparty/sparsepp/bench.md
  7. 0
      resources/3rdparty/sparsepp/docs/.gitignore
  8. 128
      resources/3rdparty/sparsepp/examples/emplace.cc
  9. 47
      resources/3rdparty/sparsepp/examples/hash_std.cc
  10. 18
      resources/3rdparty/sparsepp/examples/makefile
  11. 82
      resources/3rdparty/sparsepp/examples/serialize_file.cc
  12. 97
      resources/3rdparty/sparsepp/examples/serialize_large.cc
  13. 64
      resources/3rdparty/sparsepp/examples/serialize_stream.cc
  14. 172
      resources/3rdparty/sparsepp/examples/vsprojects/serialize_stream.vcxproj
  15. 13
      resources/3rdparty/sparsepp/examples/vsprojects/serialize_stream.vcxproj.filters
  16. 28
      resources/3rdparty/sparsepp/examples/vsprojects/spp_examples.sln
  17. 4347
      resources/3rdparty/sparsepp/sparsepp/spp.h
  18. 781
      resources/3rdparty/sparsepp/sparsepp/spp_config.h
  19. 4023
      resources/3rdparty/sparsepp/sparsepp/spp_dlalloc.h
  20. 121
      resources/3rdparty/sparsepp/sparsepp/spp_memory.h
  21. 76
      resources/3rdparty/sparsepp/sparsepp/spp_smartptr.h
  22. 16
      resources/3rdparty/sparsepp/sparsepp/spp_stdint.h
  23. 58
      resources/3rdparty/sparsepp/sparsepp/spp_timer.h
  24. 122
      resources/3rdparty/sparsepp/sparsepp/spp_traits.h
  25. 447
      resources/3rdparty/sparsepp/sparsepp/spp_utils.h
  26. 41
      resources/3rdparty/sparsepp/spp.natvis
  27. 27
      resources/3rdparty/sparsepp/tests/makefile
  28. 162
      resources/3rdparty/sparsepp/tests/perftest1.cc
  29. 189
      resources/3rdparty/sparsepp/tests/spp_alloc_test.cc
  30. 284
      resources/3rdparty/sparsepp/tests/spp_bitset_test.cc
  31. 2988
      resources/3rdparty/sparsepp/tests/spp_test.cc
  32. 38
      resources/3rdparty/sparsepp/tests/vsprojects/spp.sln
  33. 176
      resources/3rdparty/sparsepp/tests/vsprojects/spp_alloc_test.vcxproj
  34. 28
      resources/3rdparty/sparsepp/tests/vsprojects/spp_alloc_test.vcxproj.filters
  35. 175
      resources/3rdparty/sparsepp/tests/vsprojects/spp_test.vcxproj
  36. 32
      resources/3rdparty/sparsepp/tests/vsprojects/spp_test.vcxproj.filters

47
resources/3rdparty/sparsepp/.gitignore

@ -0,0 +1,47 @@
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# =========================
# Operating System Files
# =========================
# OSX
# =========================
.DS_Store
.AppleDouble
.LSOverride
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

14
resources/3rdparty/sparsepp/.travis.yml

@ -0,0 +1,14 @@
language: cpp
os:
- linux
- osx
compiler:
- clang
- gcc
dist: trusty
sudo: false
script: cd tests && make && make test

16
resources/3rdparty/sparsepp/CHANGELOG.md

@ -0,0 +1,16 @@
# 0.95
* not single header anymore (this was just too much of a hassle).
* custom allocator not quite ready yet. Checked in, but still using old allocator (easy to toggle - line 15 of spp_config.h)
# 0.90
* stable release (single header)
* known issues:
- memory usage can be excessive in Windows
sparsepp has a very simple default allocator based on the system malloc/realloc/free implementation,
and the default Windows realloc() appears to fragment the memory, causing significantly higher
memory usage than on linux. To solve this issue, I am working on a new allocator which will
remedy the problem.

0
resources/3rdparty/sparsepp/LICENSE

14
resources/3rdparty/sparsepp/README.md

@ -98,6 +98,16 @@ These classes provide the same interface as std::unordered_map and std::unordere
- Since items are not grouped into buckets, Bucket APIs have been adapted: `max_bucket_count` is equivalent to `max_size`, and `bucket_count` returns the sparsetable size, which is normally at least twice the number of items inserted into the hash_map.
## Memory allocator on Windows (when building with Visual Studio)
When building with the Microsoft compiler, we provide a custom allocator because the default one (from the Visual C++ runtime) fragments memory when reallocating.
This is desirable *only* when creating large sparsepp hash maps. If you create lots of small hash_maps, memory usage may increase instead of decreasing as expected. The reason is that, for each instance of a hash_map, the custom memory allocator creates a new memory space to allocate from, which is typically 4K, so it may be a big waste if just a few items are allocated.
In order to use the custom spp allocator, define the following preprocessor variable before including `<spp/spp.h>`:
`#define SPP_USE_SPP_ALLOC 1`
## Integer keys, and other hash function considerations.
1. For basic integer types, sparsepp provides a default hash function which does some mixing of the bits of the keys (see [Integer Hashing](http://burtleburtle.net/bob/hash/integer.html)). This prevents a pathological case where inserted keys are sequential (1, 2, 3, 4, ...), and the lookup on non-present keys becomes very slow.
@ -229,7 +239,7 @@ This support is implemented in the following APIs:
bool unserialize(Serializer serializer, INPUT *stream);
```
The following example demontrates how a simple sparse_hash_map can be written to a file, and then read back. The serializer we use read and writes to a file using the stdio APIs, but it would be equally simple to write a serialized using the stream APIS:
The following example demonstrates how a simple sparse_hash_map can be written to a file, and then read back. The serializer we use read and writes to a file using the stdio APIs, but it would be equally simple to write a serialized using the stream APIS:
```c++
#include <cstdio>
@ -319,7 +329,7 @@ int main(int argc, char* argv[])
## Thread safety
Sparsepp follows the trade safety rules of the Standard C++ library. In Particular:
Sparsepp follows the thread safety rules of the Standard C++ library. In Particular:
- A single sparsepp hash table is thread safe for reading from multiple threads. For example, given a hash table A, it is safe to read A from thread 1 and from thread 2 simultaneously.

0
resources/3rdparty/sparsepp/bench.md

0
resources/3rdparty/sparsepp/docs/.gitignore

128
resources/3rdparty/sparsepp/examples/emplace.cc

@ -0,0 +1,128 @@
#include <map>
#include <unordered_map>
#include <string>
#include <iostream>
#include <chrono>
#include <vector>
#include <sparsepp/spp.h>
#include <sstream>
namespace patch
{
template <typename T> std::string to_string(const T& n)
{
std::ostringstream stm;
stm << n;
return stm.str();
}
}
#if defined(SPP_NO_CXX11_RVALUE_REFERENCES)
#warning "problem: we expect spp will detect we have rvalue support"
#endif
template <typename T>
using milliseconds = std::chrono::duration<T, std::milli>;
class custom_type
{
std::string one = "one";
std::string two = "two";
std::uint32_t three = 3;
std::uint64_t four = 4;
std::uint64_t five = 5;
public:
custom_type() = default;
// Make object movable and non-copyable
custom_type(custom_type &&) = default;
custom_type& operator=(custom_type &&) = default;
// should be automatically deleted per http://www.slideshare.net/ripplelabs/howard-hinnant-accu2014
//custom_type(custom_type const&) = delete;
//custom_type& operator=(custom_type const&) = delete;
};
void test(std::size_t iterations, std::size_t container_size)
{
std::clog << "bench: iterations: " << iterations << " / container_size: " << container_size << "\n";
{
std::size_t count = 0;
auto t1 = std::chrono::high_resolution_clock::now();
for (std::size_t i=0; i<iterations; ++i)
{
std::unordered_map<std::string,custom_type> m;
m.reserve(container_size);
for (std::size_t j=0; j<container_size; ++j)
m.emplace(patch::to_string(j),custom_type());
count += m.size();
}
auto t2 = std::chrono::high_resolution_clock::now();
auto elapsed = milliseconds<double>(t2 - t1).count();
if (count != iterations*container_size)
std::clog << " invalid count: " << count << "\n";
std::clog << " std::unordered_map: " << std::fixed << int(elapsed) << " ms\n";
}
{
std::size_t count = 0;
auto t1 = std::chrono::high_resolution_clock::now();
for (std::size_t i=0; i<iterations; ++i)
{
std::map<std::string,custom_type> m;
for (std::size_t j=0; j<container_size; ++j)
m.emplace(patch::to_string(j),custom_type());
count += m.size();
}
auto t2 = std::chrono::high_resolution_clock::now();
auto elapsed = milliseconds<double>(t2 - t1).count();
if (count != iterations*container_size)
std::clog << " invalid count: " << count << "\n";
std::clog << " std::map: " << std::fixed << int(elapsed) << " ms\n";
}
{
std::size_t count = 0;
auto t1 = std::chrono::high_resolution_clock::now();
for (std::size_t i=0; i<iterations; ++i)
{
std::vector<std::pair<std::string,custom_type>> m;
m.reserve(container_size);
for (std::size_t j=0; j<container_size; ++j)
m.emplace_back(patch::to_string(j),custom_type());
count += m.size();
}
auto t2 = std::chrono::high_resolution_clock::now();
auto elapsed = milliseconds<double>(t2 - t1).count();
if (count != iterations*container_size)
std::clog << " invalid count: " << count << "\n";
std::clog << " std::vector<std::pair>: " << std::fixed << int(elapsed) << " ms\n";
}
{
std::size_t count = 0;
auto t1 = std::chrono::high_resolution_clock::now();
for (std::size_t i=0; i<iterations; ++i)
{
spp::sparse_hash_map<std::string,custom_type> m;
m.reserve(container_size);
for (std::size_t j=0; j<container_size; ++j)
m.emplace(patch::to_string(j),custom_type());
count += m.size();
}
auto t2 = std::chrono::high_resolution_clock::now();
auto elapsed = milliseconds<double>(t2 - t1).count();
if (count != iterations*container_size)
std::clog << " invalid count: " << count << "\n";
std::clog << " spp::sparse_hash_map: " << std::fixed << int(elapsed) << " ms\n";
}
}
int main()
{
std::size_t iterations = 100000;
test(iterations,1);
test(iterations,10);
test(iterations,50);
}

47
resources/3rdparty/sparsepp/examples/hash_std.cc

@ -0,0 +1,47 @@
#include <iostream>
#include <string>
#include <sparsepp/spp.h>
using std::string;
struct Person
{
bool operator==(const Person &o) const
{
return _first == o._first && _last == o._last;
}
string _first;
string _last;
};
namespace std
{
// inject specialization of std::hash for Person into namespace std
// ----------------------------------------------------------------
template<>
struct hash<Person>
{
std::size_t operator()(Person const &p) const
{
std::size_t seed = 0;
spp::hash_combine(seed, p._first);
spp::hash_combine(seed, p._last);
return seed;
}
};
}
int main()
{
// As we have defined a specialization of std::hash() for Person,
// we can now create sparse_hash_set or sparse_hash_map of Persons
// ----------------------------------------------------------------
spp::sparse_hash_set<Person> persons =
{ { "John", "Galt" },
{ "Jane", "Doe" }
};
for (auto& p: persons)
std::cout << p._first << ' ' << p._last << '\n';
}

18
resources/3rdparty/sparsepp/examples/makefile

@ -0,0 +1,18 @@
CXXFLAGS = -O2 -std=c++11 -I..
CXXFLAGS += -Wall -pedantic -Wextra -D_XOPEN_SOURCE=700
SPP_DEPS_1 = spp.h spp_utils.h spp_dlalloc.h spp_traits.h spp_config.h
SPP_DEPS = $(addprefix ../sparsepp/,$(SPP_DEPS_1))
TARGETS = emplace hash_std serialize_file serialize_stream serialize_large
ifeq ($(OS),Windows_NT)
LDFLAGS = -lpsapi
endif
all: $(TARGETS)
clean:
rm -f $(TARGETS) ages.dmp data.dat vsprojects/x64/* vsprojects/x86/*
%: %.cc $(SPP_DEPS) makefile
$(CXX) $(CXXFLAGS) -DNDEBUG $< -o $@ $(LDFLAGS)

82
resources/3rdparty/sparsepp/examples/serialize_file.cc

@ -0,0 +1,82 @@
#include <cstdio>
#include <sparsepp/spp.h>
using spp::sparse_hash_map;
using namespace std;
class FileSerializer
{
public:
// serialize basic types to FILE
// -----------------------------
template <class T>
bool operator()(FILE *fp, const T& value)
{
return fwrite((const void *)&value, sizeof(value), 1, fp) == 1;
}
template <class T>
bool operator()(FILE *fp, T* value)
{
return fread((void *)value, sizeof(*value), 1, fp) == 1;
}
// serialize std::string to FILE
// -----------------------------
bool operator()(FILE *fp, const string& value)
{
const size_t size = value.size();
return (*this)(fp, size) && fwrite(value.c_str(), size, 1, fp) == 1;
}
bool operator()(FILE *fp, string* value)
{
size_t size;
if (!(*this)(fp, &size))
return false;
char* buf = new char[size];
if (fread(buf, size, 1, fp) != 1)
{
delete [] buf;
return false;
}
new (value) string(buf, (size_t)size);
delete[] buf;
return true;
}
// serialize std::pair<const A, B> to FILE - needed for maps
// ---------------------------------------------------------
template <class A, class B>
bool operator()(FILE *fp, const std::pair<const A, B>& value)
{
return (*this)(fp, value.first) && (*this)(fp, value.second);
}
template <class A, class B>
bool operator()(FILE *fp, std::pair<const A, B> *value)
{
return (*this)(fp, (A *)&value->first) && (*this)(fp, &value->second);
}
};
int main(int, char* [])
{
sparse_hash_map<string, int> age{ { "John", 12 }, {"Jane", 13 }, { "Fred", 8 } };
// serialize age hash_map to "ages.dmp" file
FILE *out = fopen("ages.dmp", "wb");
age.serialize(FileSerializer(), out);
fclose(out);
sparse_hash_map<string, int> age_read;
// read from "ages.dmp" file into age_read hash_map
FILE *input = fopen("ages.dmp", "rb");
age_read.unserialize(FileSerializer(), input);
fclose(input);
// print out contents of age_read to verify correct serialization
for (auto& v : age_read)
printf("age_read: %s -> %d\n", v.first.c_str(), v.second);
}

97
resources/3rdparty/sparsepp/examples/serialize_large.cc

@ -0,0 +1,97 @@
#include <cstdio>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <sparsepp/spp_timer.h>
#include <sparsepp/spp_memory.h>
#include <sparsepp/spp.h>
using spp::sparse_hash_map;
using namespace std;
class FileSerializer
{
public:
// serialize basic types to FILE
// -----------------------------
template <class T>
bool operator()(FILE *fp, const T& value)
{
return fwrite((const void *)&value, sizeof(value), 1, fp) == 1;
}
template <class T>
bool operator()(FILE *fp, T* value)
{
return fread((void *)value, sizeof(*value), 1, fp) == 1;
}
// serialize std::string to FILE
// -----------------------------
bool operator()(FILE *fp, const string& value)
{
const size_t size = value.size();
return (*this)(fp, size) && fwrite(value.c_str(), size, 1, fp) == 1;
}
bool operator()(FILE *fp, string* value)
{
size_t size;
if (!(*this)(fp, &size))
return false;
char* buf = new char[size];
if (fread(buf, size, 1, fp) != 1)
{
delete [] buf;
return false;
}
new (value) string(buf, (size_t)size);
delete[] buf;
return true;
}
// serialize std::pair<const A, B> to FILE - needed for maps
// ---------------------------------------------------------
template <class A, class B>
bool operator()(FILE *fp, const std::pair<const A, B>& value)
{
return (*this)(fp, value.first) && (*this)(fp, value.second);
}
template <class A, class B>
bool operator()(FILE *fp, std::pair<const A, B> *value)
{
return (*this)(fp, (A *)&value->first) && (*this)(fp, &value->second);
}
};
float _to_gb(uint64_t m) { return (float)((double)m / (1024 * 1024 * 1024)); }
int main(int, char* [])
{
sparse_hash_map<string, int> age;
for (size_t i=0; i<10000000; ++i)
{
char buff[20];
sprintf(buff, "%zu", i);
age.insert(std::make_pair(std::string(buff), i));
}
printf("before serialize(): mem_usage %4.1f GB\n", _to_gb(spp::GetProcessMemoryUsed()));
// serialize age hash_map to "ages.dmp" file
FILE *out = fopen("ages.dmp", "wb");
age.serialize(FileSerializer(), out);
fclose(out);
printf("before clear(): mem_usage %4.1f GB\n", _to_gb(spp::GetProcessMemoryUsed()));
age.clear();
printf("after clear(): mem_usage %4.1f GB\n", _to_gb(spp::GetProcessMemoryUsed()));
// read from "ages.dmp" file into age_read hash_map
FILE *input = fopen("ages.dmp", "rb");
age.unserialize(FileSerializer(), input);
fclose(input);
printf("after unserialize(): mem_usage %4.1f GB\n", _to_gb(spp::GetProcessMemoryUsed()));
}

64
resources/3rdparty/sparsepp/examples/serialize_stream.cc

@ -0,0 +1,64 @@
#include <iostream>
#include <algorithm>
#include <fstream>
#include <sparsepp/spp.h>
using spp::sparse_hash_map;
using namespace std;
struct StringToIntSerializer
{
bool operator()(std::ofstream* stream, const std::pair<const std::string, int>& value) const
{
size_t sizeSecond = sizeof(value.second);
size_t sizeFirst = value.first.size();
stream->write((char*)&sizeFirst, sizeof(sizeFirst));
stream->write(value.first.c_str(), sizeFirst);
stream->write((char*)&value.second, sizeSecond);
return true;
}
bool operator()(std::ifstream* istream, std::pair<const std::string, int>* value) const
{
// Read key
size_t size = 0;
istream->read((char*)&size, sizeof(size));
char * first = new char[size];
istream->read(first, size);
new (const_cast<string *>(&value->first)) string(first, size);
// Read value
istream->read((char *)&value->second, sizeof(value->second));
return true;
}
};
int main(int , char* [])
{
sparse_hash_map<string, int> users;
users["John"] = 12345;
users["Bob"] = 553;
users["Alice"] = 82200;
// Write users to file "data.dat"
// ------------------------------
std::ofstream* stream = new std::ofstream("data.dat",
std::ios::out | std::ios::trunc | std::ios::binary);
users.serialize(StringToIntSerializer(), stream);
stream->close();
delete stream;
// Read from file "data.dat" into users2
// -------------------------------------
sparse_hash_map<string, int> users2;
std::ifstream* istream = new std::ifstream("data.dat");
users2.unserialize(StringToIntSerializer(), istream);
istream->close();
delete istream;
for (sparse_hash_map<string, int>::iterator it = users2.begin(); it != users2.end(); ++it)
printf("users2: %s -> %d\n", it->first.c_str(), it->second);
}

172
resources/3rdparty/sparsepp/examples/vsprojects/serialize_stream.vcxproj

@ -0,0 +1,172 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\serialize_stream.cc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\sparsepp\spp.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{19BC4240-15ED-4C76-BC57-34BB70FE163B}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<ProjectName>serialize_stream</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>14.0.23107.0</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_alloc_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)spp_alloc_test.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_alloc_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)spp_alloc_test.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_alloc_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_alloc_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

13
resources/3rdparty/sparsepp/examples/vsprojects/serialize_stream.vcxproj.filters

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{ba5fa1b8-1783-4b3b-9a41-31d363b52841}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\sparsepp\spp.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

28
resources/3rdparty/sparsepp/examples/vsprojects/spp_examples.sln

@ -0,0 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "serialize_stream", "serialize_stream.vcxproj", "{19BC4240-15ED-4C76-BC57-34BB70FE163B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Debug|x64.ActiveCfg = Debug|x64
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Debug|x64.Build.0 = Debug|x64
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Debug|x86.ActiveCfg = Debug|Win32
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Debug|x86.Build.0 = Debug|Win32
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Release|x64.ActiveCfg = Release|x64
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Release|x64.Build.0 = Release|x64
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Release|x86.ActiveCfg = Release|Win32
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

4347
resources/3rdparty/sparsepp/sparsepp/spp.h
File diff suppressed because it is too large
View File

781
resources/3rdparty/sparsepp/sparsepp/spp_config.h

@ -0,0 +1,781 @@
#if !defined(spp_config_h_guard)
#define spp_config_h_guard
// --------------------------------------------------
// Sparsepp config macros
// some can be overriden on the command line
// --------------------------------------------------
#ifndef SPP_NAMESPACE
#define SPP_NAMESPACE spp
#endif
#ifndef spp_
#define spp_ SPP_NAMESPACE
#endif
#ifndef SPP_DEFAULT_ALLOCATOR
#if (defined(SPP_USE_SPP_ALLOC) && SPP_USE_SPP_ALLOC) && defined(_MSC_VER)
// -----------------------------------------------------------------------------
// When building with the Microsoft compiler, we use a custom allocator because
// the default one fragments memory when reallocating. This is desirable only
// when creating large sparsepp hash maps. If you create lots of small hash_maps,
// define the following before including spp.h:
// #define SPP_DEFAULT_ALLOCATOR spp::libc_allocator
// -----------------------------------------------------------------------------
#define SPP_DEFAULT_ALLOCATOR spp_::spp_allocator
#define SPP_INCLUDE_SPP_ALLOC
#else
#define SPP_DEFAULT_ALLOCATOR spp_::libc_allocator
#endif
#endif
#ifndef SPP_GROUP_SIZE
// must be 32 or 64
#define SPP_GROUP_SIZE 32
#endif
#ifndef SPP_ALLOC_SZ
// must be power of 2 (0 = agressive alloc, 1 = smallest memory usage, 2 = good compromise)
#define SPP_ALLOC_SZ 0
#endif
#ifndef SPP_STORE_NUM_ITEMS
// 1 uses a little bit more memory, but faster!!
#define SPP_STORE_NUM_ITEMS 1
#endif
// ---------------------------------------------------------------------------
// Compiler detection code (SPP_ proprocessor macros) derived from Boost
// libraries. Therefore Boost software licence reproduced below.
// ---------------------------------------------------------------------------
// Boost Software License - Version 1.0 - August 17th, 2003
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// ---------------------------------------------------------------------------
// Boost like configuration
// ------------------------
#if defined __clang__
#if defined(i386)
#include <cpuid.h>
inline void spp_cpuid(int info[4], int InfoType) {
__cpuid_count(InfoType, 0, info[0], info[1], info[2], info[3]);
}
#endif
#define SPP_POPCNT __builtin_popcount
#define SPP_POPCNT64 __builtin_popcountll
#define SPP_HAS_CSTDINT
#ifndef __has_extension
#define __has_extension __has_feature
#endif
#if !__has_feature(cxx_exceptions) && !defined(SPP_NO_EXCEPTIONS)
#define SPP_NO_EXCEPTIONS
#endif
#if !__has_feature(cxx_rtti) && !defined(SPP_NO_RTTI)
#define SPP_NO_RTTI
#endif
#if !__has_feature(cxx_rtti) && !defined(SPP_NO_TYPEID)
#define SPP_NO_TYPEID
#endif
#if defined(__int64) && !defined(__GNUC__)
#define SPP_HAS_MS_INT64
#endif
#define SPP_HAS_NRVO
// Branch prediction hints
#if defined(__has_builtin)
#if __has_builtin(__builtin_expect)
#define SPP_LIKELY(x) __builtin_expect(x, 1)
#define SPP_UNLIKELY(x) __builtin_expect(x, 0)
#endif
#endif
// Clang supports "long long" in all compilation modes.
#define SPP_HAS_LONG_LONG
#if !__has_feature(cxx_constexpr)
#define SPP_NO_CXX11_CONSTEXPR
#endif
#if !__has_feature(cxx_decltype)
#define SPP_NO_CXX11_DECLTYPE
#endif
#if !__has_feature(cxx_decltype_incomplete_return_types)
#define SPP_NO_CXX11_DECLTYPE_N3276
#endif
#if !__has_feature(cxx_defaulted_functions)
#define SPP_NO_CXX11_DEFAULTED_FUNCTIONS
#endif
#if !__has_feature(cxx_deleted_functions)
#define SPP_NO_CXX11_DELETED_FUNCTIONS
#endif
#if !__has_feature(cxx_explicit_conversions)
#define SPP_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
#endif
#if !__has_feature(cxx_default_function_template_args)
#define SPP_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
#endif
#if !__has_feature(cxx_generalized_initializers)
#define SPP_NO_CXX11_HDR_INITIALIZER_LIST
#endif
#if !__has_feature(cxx_lambdas)
#define SPP_NO_CXX11_LAMBDAS
#endif
#if !__has_feature(cxx_local_type_template_args)
#define SPP_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
#endif
#if !__has_feature(cxx_raw_string_literals)
#define SPP_NO_CXX11_RAW_LITERALS
#endif
#if !__has_feature(cxx_reference_qualified_functions)
#define SPP_NO_CXX11_REF_QUALIFIERS
#endif
#if !__has_feature(cxx_generalized_initializers)
#define SPP_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
#endif
#if !__has_feature(cxx_rvalue_references)
#define SPP_NO_CXX11_RVALUE_REFERENCES
#endif
#if !__has_feature(cxx_static_assert)
#define SPP_NO_CXX11_STATIC_ASSERT
#endif
#if !__has_feature(cxx_alias_templates)
#define SPP_NO_CXX11_TEMPLATE_ALIASES
#endif
#if !__has_feature(cxx_variadic_templates)
#define SPP_NO_CXX11_VARIADIC_TEMPLATES
#endif
#if !__has_feature(cxx_user_literals)
#define SPP_NO_CXX11_USER_DEFINED_LITERALS
#endif
#if !__has_feature(cxx_alignas)
#define SPP_NO_CXX11_ALIGNAS
#endif
#if !__has_feature(cxx_trailing_return)
#define SPP_NO_CXX11_TRAILING_RESULT_TYPES
#endif
#if !__has_feature(cxx_inline_namespaces)
#define SPP_NO_CXX11_INLINE_NAMESPACES
#endif
#if !__has_feature(cxx_override_control)
#define SPP_NO_CXX11_FINAL
#endif
#if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__))
#define SPP_NO_CXX14_BINARY_LITERALS
#endif
#if !__has_feature(__cxx_decltype_auto__)
#define SPP_NO_CXX14_DECLTYPE_AUTO
#endif
#if !__has_feature(__cxx_init_captures__)
#define SPP_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
#endif
#if !__has_feature(__cxx_generic_lambdas__)
#define SPP_NO_CXX14_GENERIC_LAMBDAS
#endif
#if !__has_feature(__cxx_generic_lambdas__) || !__has_feature(__cxx_relaxed_constexpr__)
#define SPP_NO_CXX14_CONSTEXPR
#endif
#if !__has_feature(__cxx_return_type_deduction__)
#define SPP_NO_CXX14_RETURN_TYPE_DEDUCTION
#endif
#if !__has_feature(__cxx_variable_templates__)
#define SPP_NO_CXX14_VARIABLE_TEMPLATES
#endif
#if __cplusplus < 201400
#define SPP_NO_CXX14_DIGIT_SEPARATORS
#endif
#if defined(__has_builtin) && __has_builtin(__builtin_unreachable)
#define SPP_UNREACHABLE_RETURN(x) __builtin_unreachable();
#endif
#define SPP_ATTRIBUTE_UNUSED __attribute__((__unused__))
#ifndef SPP_COMPILER
#define SPP_COMPILER "Clang version " __clang_version__
#endif
#define SPP_CLANG 1
#elif defined __GNUC__
#define SPP_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
// definition to expand macro then apply to pragma message
// #define VALUE_TO_STRING(x) #x
// #define VALUE(x) VALUE_TO_STRING(x)
// #define VAR_NAME_VALUE(var) #var "=" VALUE(var)
// #pragma message(VAR_NAME_VALUE(SPP_GCC_VERSION))
#if defined(i386)
#include <cpuid.h>
inline void spp_cpuid(int info[4], int InfoType) {
__cpuid_count(InfoType, 0, info[0], info[1], info[2], info[3]);
}
#endif
// __POPCNT__ defined when the compiled with popcount support
// (-mpopcnt compiler option is given for example)
#ifdef __POPCNT__
// slower unless compiled iwith -mpopcnt
#define SPP_POPCNT __builtin_popcount
#define SPP_POPCNT64 __builtin_popcountll
#endif
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
#define SPP_GCC_CXX11
#endif
#if __GNUC__ == 3
#if defined (__PATHSCALE__)
#define SPP_NO_TWO_PHASE_NAME_LOOKUP
#define SPP_NO_IS_ABSTRACT
#endif
#if __GNUC_MINOR__ < 4
#define SPP_NO_IS_ABSTRACT
#endif
#define SPP_NO_CXX11_EXTERN_TEMPLATE
#endif
#if __GNUC__ < 4
//
// All problems to gcc-3.x and earlier here:
//
#define SPP_NO_TWO_PHASE_NAME_LOOKUP
#ifdef __OPEN64__
#define SPP_NO_IS_ABSTRACT
#endif
#endif
// GCC prior to 3.4 had #pragma once too but it didn't work well with filesystem links
#if SPP_GCC_VERSION >= 30400
#define SPP_HAS_PRAGMA_ONCE
#endif
#if SPP_GCC_VERSION < 40400
// Previous versions of GCC did not completely implement value-initialization:
// GCC Bug 30111, "Value-initialization of POD base class doesn't initialize
// members", reported by Jonathan Wakely in 2006,
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30111 (fixed for GCC 4.4)
// GCC Bug 33916, "Default constructor fails to initialize array members",
// reported by Michael Elizabeth Chastain in 2007,
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33916 (fixed for GCC 4.2.4)
// See also: http://www.boost.org/libs/utility/value_init.htm #compiler_issues
#define SPP_NO_COMPLETE_VALUE_INITIALIZATION
#endif
#if !defined(__EXCEPTIONS) && !defined(SPP_NO_EXCEPTIONS)
#define SPP_NO_EXCEPTIONS
#endif
//
// Threading support: Turn this on unconditionally here (except for
// those platforms where we can know for sure). It will get turned off again
// later if no threading API is detected.
//
#if !defined(__MINGW32__) && !defined(linux) && !defined(__linux) && !defined(__linux__)
#define SPP_HAS_THREADS
#endif
//
// gcc has "long long"
// Except on Darwin with standard compliance enabled (-pedantic)
// Apple gcc helpfully defines this macro we can query
//
#if !defined(__DARWIN_NO_LONG_LONG)
#define SPP_HAS_LONG_LONG
#endif
//
// gcc implements the named return value optimization since version 3.1
//
#define SPP_HAS_NRVO
// Branch prediction hints
#define SPP_LIKELY(x) __builtin_expect(x, 1)
#define SPP_UNLIKELY(x) __builtin_expect(x, 0)
//
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
//
#if __GNUC__ >= 4
#if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(__CYGWIN__)
// All Win32 development environments, including 64-bit Windows and MinGW, define
// _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment,
// so does not define _WIN32 or its variants.
#define SPP_HAS_DECLSPEC
#define SPP_SYMBOL_EXPORT __attribute__((__dllexport__))
#define SPP_SYMBOL_IMPORT __attribute__((__dllimport__))
#else
#define SPP_SYMBOL_EXPORT __attribute__((__visibility__("default")))
#define SPP_SYMBOL_IMPORT
#endif
#define SPP_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
#else
// config/platform/win32.hpp will define SPP_SYMBOL_EXPORT, etc., unless already defined
#define SPP_SYMBOL_EXPORT
#endif
//
// RTTI and typeinfo detection is possible post gcc-4.3:
//
#if SPP_GCC_VERSION > 40300
#ifndef __GXX_RTTI
#ifndef SPP_NO_TYPEID
#define SPP_NO_TYPEID
#endif
#ifndef SPP_NO_RTTI
#define SPP_NO_RTTI
#endif
#endif
#endif
//
// Recent GCC versions have __int128 when in 64-bit mode.
//
// We disable this if the compiler is really nvcc with C++03 as it
// doesn't actually support __int128 as of CUDA_VERSION=7500
// even though it defines __SIZEOF_INT128__.
// See https://svn.boost.org/trac/boost/ticket/8048
// https://svn.boost.org/trac/boost/ticket/11852
// Only re-enable this for nvcc if you're absolutely sure
// of the circumstances under which it's supported:
//
#if defined(__CUDACC__)
#if defined(SPP_GCC_CXX11)
#define SPP_NVCC_CXX11
#else
#define SPP_NVCC_CXX03
#endif
#endif
#if defined(__SIZEOF_INT128__) && !defined(SPP_NVCC_CXX03)
#define SPP_HAS_INT128
#endif
//
// Recent GCC versions have a __float128 native type, we need to
// include a std lib header to detect this - not ideal, but we'll
// be including <cstddef> later anyway when we select the std lib.
//
// Nevertheless, as of CUDA 7.5, using __float128 with the host
// compiler in pre-C++11 mode is still not supported.
// See https://svn.boost.org/trac/boost/ticket/11852
//
#ifdef __cplusplus
#include <cstddef>
#else
#include <stddef.h>
#endif
#if defined(_GLIBCXX_USE_FLOAT128) && !defined(__STRICT_ANSI__) && !defined(SPP_NVCC_CXX03)
#define SPP_HAS_FLOAT128
#endif
// C++0x features in 4.3.n and later
//
#if (SPP_GCC_VERSION >= 40300) && defined(SPP_GCC_CXX11)
// C++0x features are only enabled when -std=c++0x or -std=gnu++0x are
// passed on the command line, which in turn defines
// __GXX_EXPERIMENTAL_CXX0X__.
#define SPP_HAS_DECLTYPE
#define SPP_HAS_RVALUE_REFS
#define SPP_HAS_STATIC_ASSERT
#define SPP_HAS_VARIADIC_TMPL
#define SPP_HAS_CSTDINT
#else
#define SPP_NO_CXX11_DECLTYPE
#define SPP_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
#define SPP_NO_CXX11_RVALUE_REFERENCES
#define SPP_NO_CXX11_STATIC_ASSERT
#endif
// C++0x features in 4.4.n and later
//
#if (SPP_GCC_VERSION < 40400) || !defined(SPP_GCC_CXX11)
#define SPP_NO_CXX11_AUTO_DECLARATIONS
#define SPP_NO_CXX11_AUTO_MULTIDECLARATIONS
#define SPP_NO_CXX11_CHAR16_T
#define SPP_NO_CXX11_CHAR32_T
#define SPP_NO_CXX11_HDR_INITIALIZER_LIST
#define SPP_NO_CXX11_DEFAULTED_FUNCTIONS
#define SPP_NO_CXX11_DELETED_FUNCTIONS
#define SPP_NO_CXX11_TRAILING_RESULT_TYPES
#define SPP_NO_CXX11_INLINE_NAMESPACES
#define SPP_NO_CXX11_VARIADIC_TEMPLATES
#endif
#if SPP_GCC_VERSION < 40500
#define SPP_NO_SFINAE_EXPR
#endif
// GCC 4.5 forbids declaration of defaulted functions in private or protected sections
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 5) || !defined(SPP_GCC_CXX11)
#define SPP_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS
#endif
// C++0x features in 4.5.0 and later
//
#if (SPP_GCC_VERSION < 40500) || !defined(SPP_GCC_CXX11)
#define SPP_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
#define SPP_NO_CXX11_LAMBDAS
#define SPP_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
#define SPP_NO_CXX11_RAW_LITERALS
#endif
// C++0x features in 4.6.n and later
//
#if (SPP_GCC_VERSION < 40600) || !defined(SPP_GCC_CXX11)
#define SPP_NO_CXX11_CONSTEXPR
#define SPP_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
#endif
// C++0x features in 4.7.n and later
//
#if (SPP_GCC_VERSION < 40700) || !defined(SPP_GCC_CXX11)
#define SPP_NO_CXX11_FINAL
#define SPP_NO_CXX11_TEMPLATE_ALIASES
#define SPP_NO_CXX11_USER_DEFINED_LITERALS
#define SPP_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
#endif
// C++0x features in 4.8.n and later
//
#if (SPP_GCC_VERSION < 40800) || !defined(SPP_GCC_CXX11)
#define SPP_NO_CXX11_ALIGNAS
#endif
// C++0x features in 4.8.1 and later
//
#if (SPP_GCC_VERSION < 40801) || !defined(SPP_GCC_CXX11)
#define SPP_NO_CXX11_DECLTYPE_N3276
#define SPP_NO_CXX11_REF_QUALIFIERS
#define SPP_NO_CXX14_BINARY_LITERALS
#endif
// C++14 features in 4.9.0 and later
//
#if (SPP_GCC_VERSION < 40900) || (__cplusplus < 201300)
#define SPP_NO_CXX14_RETURN_TYPE_DEDUCTION
#define SPP_NO_CXX14_GENERIC_LAMBDAS
#define SPP_NO_CXX14_DIGIT_SEPARATORS
#define SPP_NO_CXX14_DECLTYPE_AUTO
#if !((SPP_GCC_VERSION >= 40801) && (SPP_GCC_VERSION < 40900) && defined(SPP_GCC_CXX11))
#define SPP_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
#endif
#endif
// C++ 14:
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
#define SPP_NO_CXX14_CONSTEXPR
#endif
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
#define SPP_NO_CXX14_VARIABLE_TEMPLATES
#endif
//
// Unused attribute:
#if __GNUC__ >= 4
#define SPP_ATTRIBUTE_UNUSED __attribute__((__unused__))
#endif
//
// __builtin_unreachable:
#if SPP_GCC_VERSION >= 40800
#define SPP_UNREACHABLE_RETURN(x) __builtin_unreachable();
#endif
#ifndef SPP_COMPILER
#define SPP_COMPILER "GNU C++ version " __VERSION__
#endif
// ConceptGCC compiler:
// http://www.generic-programming.org/software/ConceptGCC/
#ifdef __GXX_CONCEPTS__
#define SPP_HAS_CONCEPTS
#define SPP_COMPILER "ConceptGCC version " __VERSION__
#endif
#elif defined _MSC_VER
#include <intrin.h> // for __popcnt()
#define SPP_POPCNT_CHECK // slower when defined, but we have to check!
#define spp_cpuid(info, x) __cpuid(info, x)
#define SPP_POPCNT __popcnt
#if (SPP_GROUP_SIZE == 64 && INTPTR_MAX == INT64_MAX)
#define SPP_POPCNT64 __popcnt64
#endif
// Attempt to suppress VC6 warnings about the length of decorated names (obsolete):
#pragma warning( disable : 4503 ) // warning: decorated name length exceeded
#define SPP_HAS_PRAGMA_ONCE
#define SPP_HAS_CSTDINT
//
// versions check:
// we don't support Visual C++ prior to version 7.1:
#if _MSC_VER < 1310
#error "Antique compiler not supported"
#endif
#if _MSC_FULL_VER < 180020827
#define SPP_NO_FENV_H
#endif
#if _MSC_VER < 1400
// although a conforming signature for swprint exists in VC7.1
// it appears not to actually work:
#define SPP_NO_SWPRINTF
// Our extern template tests also fail for this compiler:
#define SPP_NO_CXX11_EXTERN_TEMPLATE
// Variadic macros do not exist for VC7.1 and lower
#define SPP_NO_CXX11_VARIADIC_MACROS
#endif
#if _MSC_VER < 1500 // 140X == VC++ 8.0
#undef SPP_HAS_CSTDINT
#define SPP_NO_MEMBER_TEMPLATE_FRIENDS
#endif
#if _MSC_VER < 1600 // 150X == VC++ 9.0
// A bug in VC9:
#define SPP_NO_ADL_BARRIER
#endif
// MSVC (including the latest checked version) has not yet completely
// implemented value-initialization, as is reported:
// "VC++ does not value-initialize members of derived classes without
// user-declared constructor", reported in 2009 by Sylvester Hesp:
// https: //connect.microsoft.com/VisualStudio/feedback/details/484295
// "Presence of copy constructor breaks member class initialization",
// reported in 2009 by Alex Vakulenko:
// https: //connect.microsoft.com/VisualStudio/feedback/details/499606
// "Value-initialization in new-expression", reported in 2005 by
// Pavel Kuznetsov (MetaCommunications Engineering):
// https: //connect.microsoft.com/VisualStudio/feedback/details/100744
// See also: http: //www.boost.org/libs/utility/value_init.htm #compiler_issues
// (Niels Dekker, LKEB, May 2010)
#define SPP_NO_COMPLETE_VALUE_INITIALIZATION
#ifndef _NATIVE_WCHAR_T_DEFINED
#define SPP_NO_INTRINSIC_WCHAR_T
#endif
//
// check for exception handling support:
#if !defined(_CPPUNWIND) && !defined(SPP_NO_EXCEPTIONS)
#define SPP_NO_EXCEPTIONS
#endif
//
// __int64 support:
//
#define SPP_HAS_MS_INT64
#if defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1400)
#define SPP_HAS_LONG_LONG
#else
#define SPP_NO_LONG_LONG
#endif
#if (_MSC_VER >= 1400) && !defined(_DEBUG)
#define SPP_HAS_NRVO
#endif
#if _MSC_VER >= 1500 // 150X == VC++ 9.0
#define SPP_HAS_PRAGMA_DETECT_MISMATCH
#endif
//
// disable Win32 API's if compiler extensions are
// turned off:
//
#if !defined(_MSC_EXTENSIONS) && !defined(SPP_DISABLE_WIN32)
#define SPP_DISABLE_WIN32
#endif
#if !defined(_CPPRTTI) && !defined(SPP_NO_RTTI)
#define SPP_NO_RTTI
#endif
//
// TR1 features:
//
#if _MSC_VER >= 1700
// #define SPP_HAS_TR1_HASH // don't know if this is true yet.
// #define SPP_HAS_TR1_TYPE_TRAITS // don't know if this is true yet.
#define SPP_HAS_TR1_UNORDERED_MAP
#define SPP_HAS_TR1_UNORDERED_SET
#endif
//
// C++0x features
//
// See above for SPP_NO_LONG_LONG
// C++ features supported by VC++ 10 (aka 2010)
//
#if _MSC_VER < 1600
#define SPP_NO_CXX11_AUTO_DECLARATIONS
#define SPP_NO_CXX11_AUTO_MULTIDECLARATIONS
#define SPP_NO_CXX11_LAMBDAS
#define SPP_NO_CXX11_RVALUE_REFERENCES
#define SPP_NO_CXX11_STATIC_ASSERT
#define SPP_NO_CXX11_DECLTYPE
#endif // _MSC_VER < 1600
#if _MSC_VER >= 1600
#define SPP_HAS_STDINT_H
#endif
// C++11 features supported by VC++ 11 (aka 2012)
//
#if _MSC_VER < 1700
#define SPP_NO_CXX11_FINAL
#endif // _MSC_VER < 1700
// C++11 features supported by VC++ 12 (aka 2013).
//
#if _MSC_FULL_VER < 180020827
#define SPP_NO_CXX11_DEFAULTED_FUNCTIONS
#define SPP_NO_CXX11_DELETED_FUNCTIONS
#define SPP_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
#define SPP_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
#define SPP_NO_CXX11_RAW_LITERALS
#define SPP_NO_CXX11_TEMPLATE_ALIASES
#define SPP_NO_CXX11_TRAILING_RESULT_TYPES
#define SPP_NO_CXX11_VARIADIC_TEMPLATES
#define SPP_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
#define SPP_NO_CXX11_DECLTYPE_N3276
#endif
// C++11 features supported by VC++ 14 (aka 2014) CTP1
#if (_MSC_FULL_VER < 190021730)
#define SPP_NO_CXX11_REF_QUALIFIERS
#define SPP_NO_CXX11_USER_DEFINED_LITERALS
#define SPP_NO_CXX11_ALIGNAS
#define SPP_NO_CXX11_INLINE_NAMESPACES
#define SPP_NO_CXX14_DECLTYPE_AUTO
#define SPP_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
#define SPP_NO_CXX14_RETURN_TYPE_DEDUCTION
#define SPP_NO_CXX11_HDR_INITIALIZER_LIST
#endif
// C++11 features not supported by any versions
#define SPP_NO_CXX11_CHAR16_T
#define SPP_NO_CXX11_CHAR32_T
#define SPP_NO_CXX11_CONSTEXPR
#define SPP_NO_SFINAE_EXPR
#define SPP_NO_TWO_PHASE_NAME_LOOKUP
// C++ 14:
#if !defined(__cpp_binary_literals) || (__cpp_binary_literals < 201304)
#define SPP_NO_CXX14_BINARY_LITERALS
#endif
#if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304)
#define SPP_NO_CXX14_CONSTEXPR
#endif
#if (__cplusplus < 201304) // There's no SD6 check for this....
#define SPP_NO_CXX14_DIGIT_SEPARATORS
#endif
#if !defined(__cpp_generic_lambdas) || (__cpp_generic_lambdas < 201304)
#define SPP_NO_CXX14_GENERIC_LAMBDAS
#endif
#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304)
#define SPP_NO_CXX14_VARIABLE_TEMPLATES
#endif
#endif
// from boost/config/suffix.hpp
// ----------------------------
#ifndef SPP_ATTRIBUTE_UNUSED
#define SPP_ATTRIBUTE_UNUSED
#endif
/*
Try to persuade compilers to inline.
*/
#ifndef SPP_FORCEINLINE
#if defined(__GNUC__)
#define SPP_FORCEINLINE __inline __attribute__ ((always_inline))
#elif defined(_MSC_VER)
#define SPP_FORCEINLINE __forceinline
#else
#define SPP_FORCEINLINE inline
#endif
#endif
#endif // spp_config_h_guard

4023
resources/3rdparty/sparsepp/sparsepp/spp_dlalloc.h
File diff suppressed because it is too large
View File

121
resources/3rdparty/sparsepp/sparsepp/spp_memory.h

@ -0,0 +1,121 @@
#if !defined(spp_memory_h_guard)
#define spp_memory_h_guard
#include <cstdint>
#include <cstring>
#include <cstdlib>
#if defined(_WIN32) || defined( __CYGWIN__)
#define SPP_WIN
#endif
#ifdef SPP_WIN
#include <windows.h>
#include <Psapi.h>
#undef min
#undef max
#else
#include <sys/types.h>
#include <sys/sysinfo.h>
#endif
namespace spp
{
uint64_t GetSystemMemory()
{
#ifdef SPP_WIN
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&memInfo);
return static_cast<uint64_t>(memInfo.ullTotalPageFile);
#else
struct sysinfo memInfo;
sysinfo (&memInfo);
auto totalVirtualMem = memInfo.totalram;
totalVirtualMem += memInfo.totalswap;
totalVirtualMem *= memInfo.mem_unit;
return static_cast<uint64_t>(totalVirtualMem);
#endif
}
uint64_t GetTotalMemoryUsed()
{
#ifdef SPP_WIN
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&memInfo);
return static_cast<uint64_t>(memInfo.ullTotalPageFile - memInfo.ullAvailPageFile);
#else
struct sysinfo memInfo;
sysinfo(&memInfo);
auto virtualMemUsed = memInfo.totalram - memInfo.freeram;
virtualMemUsed += memInfo.totalswap - memInfo.freeswap;
virtualMemUsed *= memInfo.mem_unit;
return static_cast<uint64_t>(virtualMemUsed);
#endif
}
uint64_t GetProcessMemoryUsed()
{
#ifdef SPP_WIN
PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(GetCurrentProcess(), reinterpret_cast<PPROCESS_MEMORY_COUNTERS>(&pmc), sizeof(pmc));
return static_cast<uint64_t>(pmc.PrivateUsage);
#else
auto parseLine =
[](char* line)->int
{
auto i = strlen(line);
while(*line < '0' || *line > '9')
{
line++;
}
line[i-3] = '\0';
i = atoi(line);
return i;
};
auto file = fopen("/proc/self/status", "r");
auto result = -1;
char line[128];
while(fgets(line, 128, file) != nullptr)
{
if(strncmp(line, "VmSize:", 7) == 0)
{
result = parseLine(line);
break;
}
}
fclose(file);
return static_cast<uint64_t>(result) * 1024;
#endif
}
uint64_t GetPhysicalMemory()
{
#ifdef SPP_WIN
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&memInfo);
return static_cast<uint64_t>(memInfo.ullTotalPhys);
#else
struct sysinfo memInfo;
sysinfo(&memInfo);
auto totalPhysMem = memInfo.totalram;
totalPhysMem *= memInfo.mem_unit;
return static_cast<uint64_t>(totalPhysMem);
#endif
}
}
#endif // spp_memory_h_guard

76
resources/3rdparty/sparsepp/sparsepp/spp_smartptr.h

@ -0,0 +1,76 @@
#if !defined(spp_smartptr_h_guard)
#define spp_smartptr_h_guard
/* -----------------------------------------------------------------------------------------------
* quick version of intrusive_ptr
* -----------------------------------------------------------------------------------------------
*/
#include <cassert>
#include <sparsepp/spp_config.h>
// ------------------------------------------------------------------------
class spp_rc
{
public:
spp_rc() : _cnt(0) {}
spp_rc(const spp_rc &) : _cnt(0) {}
void increment() const { ++_cnt; }
void decrement() const { assert(_cnt); if (--_cnt == 0) delete this; }
unsigned count() const { return _cnt; }
protected:
virtual ~spp_rc() {}
private:
mutable unsigned _cnt;
};
// ------------------------------------------------------------------------
template <class T>
class spp_sptr
{
public:
spp_sptr() : _p(0) {}
spp_sptr(T *p) : _p(p) { if (_p) _p->increment(); }
spp_sptr(const spp_sptr &o) : _p(o._p) { if (_p) _p->increment(); }
#ifndef SPP_NO_CXX11_RVALUE_REFERENCES
spp_sptr(spp_sptr &&o) : _p(o._p) { o._p = (T *)0; }
spp_sptr& operator=(spp_sptr &&o)
{
if (_p) _p->decrement();
_p = o._p;
o._p = (T *)0;
}
#endif
~spp_sptr() { if (_p) _p->decrement(); }
spp_sptr& operator=(const spp_sptr &o) { reset(o._p); return *this; }
T* get() const { return _p; }
void swap(spp_sptr &o) { T *tmp = _p; _p = o._p; o._p = tmp; }
void reset(const T *p = 0)
{
if (p == _p)
return;
if (_p) _p->decrement();
_p = (T *)p;
if (_p) _p->increment();
}
T* operator->() const { return const_cast<T *>(_p); }
bool operator!() const { return _p == 0; }
private:
T *_p;
};
// ------------------------------------------------------------------------
namespace std
{
template <class T>
inline void swap(spp_sptr<T> &a, spp_sptr<T> &b)
{
a.swap(b);
}
}
#endif // spp_smartptr_h_guard

16
resources/3rdparty/sparsepp/sparsepp/spp_stdint.h

@ -0,0 +1,16 @@
#if !defined(spp_stdint_h_guard)
#define spp_stdint_h_guard
#include <sparsepp/spp_config.h>
#if defined(SPP_HAS_CSTDINT) && (__cplusplus >= 201103)
#include <cstdint>
#else
#if defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
#include <inttypes.h>
#else
#include <stdint.h>
#endif
#endif
#endif // spp_stdint_h_guard

58
resources/3rdparty/sparsepp/sparsepp/spp_timer.h

@ -0,0 +1,58 @@
/**
Copyright (c) 2016 Mariano Gonzalez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef spp_timer_h_guard
#define spp_timer_h_guard
#include <chrono>
namespace spp
{
template<typename time_unit = std::milli>
class Timer
{
public:
Timer() { reset(); }
void reset() { _start = _snap = clock::now(); }
void snap() { _snap = clock::now(); }
float get_total() const { return get_diff<float>(_start, clock::now()); }
float get_delta() const { return get_diff<float>(_snap, clock::now()); }
private:
using clock = std::chrono::high_resolution_clock;
using point = std::chrono::time_point<clock>;
template<typename T>
static T get_diff(const point& start, const point& end)
{
using duration_t = std::chrono::duration<T, time_unit>;
return std::chrono::duration_cast<duration_t>(end - start).count();
}
point _start;
point _snap;
};
}
#endif // spp_timer_h_guard

122
resources/3rdparty/sparsepp/sparsepp/spp_traits.h

@ -0,0 +1,122 @@
#if !defined(spp_traits_h_guard)
#define spp_traits_h_guard
#include <sparsepp/spp_config.h>
template<int S, int H> class HashObject; // for Google's benchmark, not in spp namespace!
namespace spp_
{
// ---------------------------------------------------------------------------
// type_traits we need
// ---------------------------------------------------------------------------
template<class T, T v>
struct integral_constant { static const T value = v; };
template <class T, T v> const T integral_constant<T, v>::value;
typedef integral_constant<bool, true> true_type;
typedef integral_constant<bool, false> false_type;
typedef integral_constant<int, 0> zero_type;
typedef integral_constant<int, 1> one_type;
typedef integral_constant<int, 2> two_type;
typedef integral_constant<int, 3> three_type;
template<typename T, typename U> struct is_same : public false_type { };
template<typename T> struct is_same<T, T> : public true_type { };
template<typename T> struct remove_const { typedef T type; };
template<typename T> struct remove_const<T const> { typedef T type; };
template<typename T> struct remove_volatile { typedef T type; };
template<typename T> struct remove_volatile<T volatile> { typedef T type; };
template<typename T> struct remove_cv
{
typedef typename remove_const<typename remove_volatile<T>::type>::type type;
};
// ---------------- is_integral ----------------------------------------
template <class T> struct is_integral;
template <class T> struct is_integral : false_type { };
template<> struct is_integral<bool> : true_type { };
template<> struct is_integral<char> : true_type { };
template<> struct is_integral<unsigned char> : true_type { };
template<> struct is_integral<signed char> : true_type { };
template<> struct is_integral<short> : true_type { };
template<> struct is_integral<unsigned short> : true_type { };
template<> struct is_integral<int> : true_type { };
template<> struct is_integral<unsigned int> : true_type { };
template<> struct is_integral<long> : true_type { };
template<> struct is_integral<unsigned long> : true_type { };
#ifdef SPP_HAS_LONG_LONG
template<> struct is_integral<long long> : true_type { };
template<> struct is_integral<unsigned long long> : true_type { };
#endif
template <class T> struct is_integral<const T> : is_integral<T> { };
template <class T> struct is_integral<volatile T> : is_integral<T> { };
template <class T> struct is_integral<const volatile T> : is_integral<T> { };
// ---------------- is_floating_point ----------------------------------------
template <class T> struct is_floating_point;
template <class T> struct is_floating_point : false_type { };
template<> struct is_floating_point<float> : true_type { };
template<> struct is_floating_point<double> : true_type { };
template<> struct is_floating_point<long double> : true_type { };
template <class T> struct is_floating_point<const T> : is_floating_point<T> { };
template <class T> struct is_floating_point<volatile T> : is_floating_point<T> { };
template <class T> struct is_floating_point<const volatile T> : is_floating_point<T> { };
// ---------------- is_pointer ----------------------------------------
template <class T> struct is_pointer;
template <class T> struct is_pointer : false_type { };
template <class T> struct is_pointer<T*> : true_type { };
template <class T> struct is_pointer<const T> : is_pointer<T> { };
template <class T> struct is_pointer<volatile T> : is_pointer<T> { };
template <class T> struct is_pointer<const volatile T> : is_pointer<T> { };
// ---------------- is_reference ----------------------------------------
template <class T> struct is_reference;
template<typename T> struct is_reference : false_type {};
template<typename T> struct is_reference<T&> : true_type {};
// ---------------- is_relocatable ----------------------------------------
// relocatable values can be moved around in memory using memcpy and remain
// correct. Most types are relocatable, an example of a type who is not would
// be a struct which contains a pointer to a buffer inside itself - this is the
// case for std::string in gcc 5.
// ------------------------------------------------------------------------
template <class T> struct is_relocatable;
template <class T> struct is_relocatable :
integral_constant<bool, (is_integral<T>::value || is_floating_point<T>::value)>
{ };
template<int S, int H> struct is_relocatable<HashObject<S, H> > : true_type { };
template <class T> struct is_relocatable<const T> : is_relocatable<T> { };
template <class T> struct is_relocatable<volatile T> : is_relocatable<T> { };
template <class T> struct is_relocatable<const volatile T> : is_relocatable<T> { };
template <class A, int N> struct is_relocatable<A[N]> : is_relocatable<A> { };
template <class T, class U> struct is_relocatable<std::pair<T, U> > :
integral_constant<bool, (is_relocatable<T>::value && is_relocatable<U>::value)>
{ };
// A template helper used to select A or B based on a condition.
// ------------------------------------------------------------
template<bool cond, typename A, typename B>
struct if_
{
typedef A type;
};
template<typename A, typename B>
struct if_<false, A, B>
{
typedef B type;
};
} // spp_ namespace
#endif // spp_traits_h_guard

447
resources/3rdparty/sparsepp/sparsepp/spp_utils.h

@ -0,0 +1,447 @@
// ----------------------------------------------------------------------
// Copyright (c) 2016, Steven Gregory Popovitch - greg7mdp@gmail.com
// All rights reserved.
//
// Code derived derived from Boost libraries.
// Boost software licence reproduced below.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * The name of Steven Gregory Popovitch may not be used to
// endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ----------------------------------------------------------------------
// ---------------------------------------------------------------------------
// Boost Software License - Version 1.0 - August 17th, 2003
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// ---------------------------------------------------------------------------
// ----------------------------------------------------------------------
// H A S H F U N C T I O N S
// ----------------------------
//
// Implements spp::spp_hash() and spp::hash_combine()
// ----------------------------------------------------------------------
#if !defined(spp_utils_h_guard_)
#define spp_utils_h_guard_
#if defined(_MSC_VER)
#if (_MSC_VER >= 1600 ) // vs2010 (1900 is vs2015)
#include <functional>
#define SPP_HASH_CLASS std::hash
#else
#include <hash_map>
#define SPP_HASH_CLASS stdext::hash_compare
#endif
#if (_MSC_FULL_VER < 190021730)
#define SPP_NO_CXX11_NOEXCEPT
#endif
#elif defined __clang__
#if __has_feature(cxx_noexcept) // what to use here?
#include <functional>
#define SPP_HASH_CLASS std::hash
#else
#include <tr1/unordered_map>
#define SPP_HASH_CLASS std::tr1::hash
#endif
#if !__has_feature(cxx_noexcept)
#define SPP_NO_CXX11_NOEXCEPT
#endif
#elif defined(__GNUC__)
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
#include <functional>
#define SPP_HASH_CLASS std::hash
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) < 40600
#define SPP_NO_CXX11_NOEXCEPT
#endif
#else
#include <tr1/unordered_map>
#define SPP_HASH_CLASS std::tr1::hash
#define SPP_NO_CXX11_NOEXCEPT
#endif
#else
#include <functional>
#define SPP_HASH_CLASS std::hash
#endif
#ifdef SPP_NO_CXX11_NOEXCEPT
#define SPP_NOEXCEPT
#else
#define SPP_NOEXCEPT noexcept
#endif
#ifdef SPP_NO_CXX11_CONSTEXPR
#define SPP_CONSTEXPR
#else
#define SPP_CONSTEXPR constexpr
#endif
#define SPP_INLINE
#ifndef spp_
#define spp_ spp
#endif
namespace spp_
{
template <class T> T spp_min(T a, T b) { return a < b ? a : b; }
template <class T> T spp_max(T a, T b) { return a >= b ? a : b; }
template <class T>
struct spp_hash
{
SPP_INLINE size_t operator()(const T &__v) const SPP_NOEXCEPT
{
SPP_HASH_CLASS<T> hasher;
return hasher(__v);
}
};
template <class T>
struct spp_hash<T *>
{
static size_t spp_log2 (size_t val) SPP_NOEXCEPT
{
size_t res = 0;
while (val > 1)
{
val >>= 1;
res++;
}
return res;
}
SPP_INLINE size_t operator()(const T *__v) const SPP_NOEXCEPT
{
static const size_t shift = 3; // spp_log2(1 + sizeof(T)); // T might be incomplete!
const uintptr_t i = (const uintptr_t)__v;
return static_cast<size_t>(i >> shift);
}
};
// from http://burtleburtle.net/bob/hash/integer.html
// fast and efficient for power of two table sizes where we always
// consider the last bits.
// ---------------------------------------------------------------
inline size_t spp_mix_32(uint32_t a)
{
a = a ^ (a >> 4);
a = (a ^ 0xdeadbeef) + (a << 5);
a = a ^ (a >> 11);
return static_cast<size_t>(a);
}
// Maybe we should do a more thorough scrambling as described in
// https://gist.github.com/badboy/6267743
// -------------------------------------------------------------
inline size_t spp_mix_64(uint64_t a)
{
a = a ^ (a >> 4);
a = (a ^ 0xdeadbeef) + (a << 5);
a = a ^ (a >> 11);
return (size_t)a;
}
template <>
struct spp_hash<bool> : public std::unary_function<bool, size_t>
{
SPP_INLINE size_t operator()(bool __v) const SPP_NOEXCEPT
{ return static_cast<size_t>(__v); }
};
template <>
struct spp_hash<char> : public std::unary_function<char, size_t>
{
SPP_INLINE size_t operator()(char __v) const SPP_NOEXCEPT
{ return static_cast<size_t>(__v); }
};
template <>
struct spp_hash<signed char> : public std::unary_function<signed char, size_t>
{
SPP_INLINE size_t operator()(signed char __v) const SPP_NOEXCEPT
{ return static_cast<size_t>(__v); }
};
template <>
struct spp_hash<unsigned char> : public std::unary_function<unsigned char, size_t>
{
SPP_INLINE size_t operator()(unsigned char __v) const SPP_NOEXCEPT
{ return static_cast<size_t>(__v); }
};
template <>
struct spp_hash<wchar_t> : public std::unary_function<wchar_t, size_t>
{
SPP_INLINE size_t operator()(wchar_t __v) const SPP_NOEXCEPT
{ return static_cast<size_t>(__v); }
};
template <>
struct spp_hash<int16_t> : public std::unary_function<int16_t, size_t>
{
SPP_INLINE size_t operator()(int16_t __v) const SPP_NOEXCEPT
{ return spp_mix_32(static_cast<uint32_t>(__v)); }
};
template <>
struct spp_hash<uint16_t> : public std::unary_function<uint16_t, size_t>
{
SPP_INLINE size_t operator()(uint16_t __v) const SPP_NOEXCEPT
{ return spp_mix_32(static_cast<uint32_t>(__v)); }
};
template <>
struct spp_hash<int32_t> : public std::unary_function<int32_t, size_t>
{
SPP_INLINE size_t operator()(int32_t __v) const SPP_NOEXCEPT
{ return spp_mix_32(static_cast<uint32_t>(__v)); }
};
template <>
struct spp_hash<uint32_t> : public std::unary_function<uint32_t, size_t>
{
SPP_INLINE size_t operator()(uint32_t __v) const SPP_NOEXCEPT
{ return spp_mix_32(static_cast<uint32_t>(__v)); }
};
template <>
struct spp_hash<int64_t> : public std::unary_function<int64_t, size_t>
{
SPP_INLINE size_t operator()(int64_t __v) const SPP_NOEXCEPT
{ return spp_mix_64(static_cast<uint64_t>(__v)); }
};
template <>
struct spp_hash<uint64_t> : public std::unary_function<uint64_t, size_t>
{
SPP_INLINE size_t operator()(uint64_t __v) const SPP_NOEXCEPT
{ return spp_mix_64(static_cast<uint64_t>(__v)); }
};
template <>
struct spp_hash<float> : public std::unary_function<float, size_t>
{
SPP_INLINE size_t operator()(float __v) const SPP_NOEXCEPT
{
// -0.0 and 0.0 should return same hash
uint32_t *as_int = reinterpret_cast<uint32_t *>(&__v);
return (__v == 0) ? static_cast<size_t>(0) : spp_mix_32(*as_int);
}
};
template <>
struct spp_hash<double> : public std::unary_function<double, size_t>
{
SPP_INLINE size_t operator()(double __v) const SPP_NOEXCEPT
{
// -0.0 and 0.0 should return same hash
uint64_t *as_int = reinterpret_cast<uint64_t *>(&__v);
return (__v == 0) ? static_cast<size_t>(0) : spp_mix_64(*as_int);
}
};
template <class T, int sz> struct Combiner
{
inline void operator()(T& seed, T value);
};
template <class T> struct Combiner<T, 4>
{
inline void operator()(T& seed, T value)
{
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
};
template <class T> struct Combiner<T, 8>
{
inline void operator()(T& seed, T value)
{
seed ^= value + T(0xc6a4a7935bd1e995) + (seed << 6) + (seed >> 2);
}
};
template <class T>
inline void hash_combine(std::size_t& seed, T const& v)
{
spp_::spp_hash<T> hasher;
Combiner<std::size_t, sizeof(std::size_t)> combiner;
combiner(seed, hasher(v));
}
static inline uint32_t s_spp_popcount_default(uint32_t i) SPP_NOEXCEPT
{
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
static inline uint32_t s_spp_popcount_default(uint64_t x) SPP_NOEXCEPT
{
const uint64_t m1 = uint64_t(0x5555555555555555); // binary: 0101...
const uint64_t m2 = uint64_t(0x3333333333333333); // binary: 00110011..
const uint64_t m4 = uint64_t(0x0f0f0f0f0f0f0f0f); // binary: 4 zeros, 4 ones ...
const uint64_t h01 = uint64_t(0x0101010101010101); // the sum of 256 to the power of 0,1,2,3...
x -= (x >> 1) & m1; // put count of each 2 bits into those 2 bits
x = (x & m2) + ((x >> 2) & m2); // put count of each 4 bits into those 4 bits
x = (x + (x >> 4)) & m4; // put count of each 8 bits into those 8 bits
return (x * h01)>>56; // returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24)+...
}
#ifdef __APPLE__
static inline uint32_t count_trailing_zeroes(size_t v) SPP_NOEXCEPT
{
size_t x = (v & -v) - 1;
// sadly sizeof() required to build on macos
return sizeof(size_t) == 8 ? s_spp_popcount_default((uint64_t)x) : s_spp_popcount_default((uint32_t)x);
}
static inline uint32_t s_popcount(size_t v) SPP_NOEXCEPT
{
// sadly sizeof() required to build on macos
return sizeof(size_t) == 8 ? s_spp_popcount_default((uint64_t)v) : s_spp_popcount_default((uint32_t)v);
}
#else
static inline uint32_t count_trailing_zeroes(size_t v) SPP_NOEXCEPT
{
return s_spp_popcount_default((v & -(intptr_t)v) - 1);
}
static inline uint32_t s_popcount(size_t v) SPP_NOEXCEPT
{
return s_spp_popcount_default(v);
}
#endif
// -----------------------------------------------------------
// -----------------------------------------------------------
template<class T>
class libc_allocator
{
public:
typedef T value_type;
typedef T* pointer;
typedef ptrdiff_t difference_type;
typedef const T* const_pointer;
typedef size_t size_type;
libc_allocator() {}
libc_allocator(const libc_allocator &) {}
libc_allocator& operator=(const libc_allocator &) { return *this; }
#ifndef SPP_NO_CXX11_RVALUE_REFERENCES
libc_allocator(libc_allocator &&) {}
libc_allocator& operator=(libc_allocator &&) { return *this; }
#endif
pointer allocate(size_t n, const_pointer /* unused */= 0)
{
return static_cast<pointer>(malloc(n * sizeof(T)));
}
void deallocate(pointer p, size_t /* unused */)
{
free(p);
}
pointer reallocate(pointer p, size_t new_size)
{
return static_cast<pointer>(realloc(p, new_size * sizeof(T)));
}
// extra API to match spp_allocator interface
pointer reallocate(pointer p, size_t /* old_size */, size_t new_size)
{
return static_cast<pointer>(realloc(p, new_size * sizeof(T)));
}
size_type max_size() const
{
return static_cast<size_type>(-1) / sizeof(value_type);
}
void construct(pointer p, const value_type& val)
{
new(p) value_type(val);
}
void destroy(pointer p) { p->~value_type(); }
template<class U>
struct rebind
{
typedef spp_::libc_allocator<U> other;
};
};
// forward declaration
// -------------------
template<class T>
class spp_allocator;
}
template<class T>
inline bool operator==(const spp_::libc_allocator<T> &, const spp_::libc_allocator<T> &)
{
return true;
}
template<class T>
inline bool operator!=(const spp_::libc_allocator<T> &, const spp_::libc_allocator<T> &)
{
return false;
}
#endif // spp_utils_h_guard_

41
resources/3rdparty/sparsepp/spp.natvis

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- VC 2015 -->
<Type Name="spp::sparse_hash_set&lt;*,*,*,*&gt;">
<AlternativeType Name="spp::sparse_hash_map&lt;*,*,*,*,*&gt;" />
<DisplayString>{{size = {rep.table._num_buckets}}}</DisplayString>
<Expand>
<CustomListItems MaxItemsPerView="1000" ExcludeView="Test">
<Variable Name="grp" InitialValue="rep.table._first_group" />
<Variable Name="last_grp" InitialValue="rep.table._last_group" />
<Variable Name="item_ptr" InitialValue="rep.table._first_group-&gt;_group" />
<Variable Name="cnt" InitialValue="-1" />
<Size>rep.table._num_buckets</Size>
<Loop>
<Break Condition="grp == last_grp" />
<Exec>item_ptr = grp-&gt;_group</Exec>
<Exec>cnt = grp-&gt;_num_buckets</Exec>
<Loop>
<Break Condition="cnt == 0" />
<Item>item_ptr,na</Item>
<Exec>item_ptr++</Exec>
<Exec>cnt--</Exec>
</Loop>
<Exec>++grp</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
<Type Name="spp::Two_d_iterator&lt;*,*,*,*&gt;">
<DisplayString Condition="row_current==0">end()</DisplayString>
<DisplayString Condition="row_current->_group == -1">end()</DisplayString>
<DisplayString>{*col_current}</DisplayString>
<Expand>
<ExpandedItem Condition="row_current->_group != -1">*col_current</ExpandedItem>
</Expand>
</Type>
</AutoVisualizer>

27
resources/3rdparty/sparsepp/tests/makefile

@ -0,0 +1,27 @@
CXXFLAGS = -O2 -std=c++11 -I..
CXXFLAGS += -Wall -pedantic -Wextra -D_XOPEN_SOURCE=700
SPP_DEPS_1 = spp.h spp_utils.h spp_dlalloc.h spp_traits.h spp_config.h
SPP_DEPS = $(addprefix ../sparsepp/,$(SPP_DEPS_1))
TARGETS = spp_test spp_alloc_test spp_bitset_test perftest1 bench
ifeq ($(OS),Windows_NT)
LDFLAGS = -lpsapi
endif
def: spp_test
all: $(TARGETS)
clean:
rm -rf $(TARGETS) vsprojects/x64/* vsprojects/x86/*
test:
./spp_test
spp_test: spp_test.cc $(SPP_DEPS) makefile
$(CXX) $(CXXFLAGS) -D_CRT_SECURE_NO_WARNINGS spp_test.cc -o spp_test
%: %.cc $(SPP_DEPS) makefile
$(CXX) $(CXXFLAGS) -DNDEBUG $< -o $@ $(LDFLAGS)

162
resources/3rdparty/sparsepp/tests/perftest1.cc

@ -0,0 +1,162 @@
// compile on linux with: g++ -std=c++11 -O2 perftest1.cc -o perftest1
// -----------------------------------------------------------------------
#include <fstream>
#include <iostream>
#include <ctime>
#include <cstdio>
#include <climits>
#include <functional>
#include <vector>
#include <utility>
#include <sparsepp/spp_timer.h>
#define SPP 1
#define DENSE 0
#define SPARSE 0
#define STD 0
#if SPP
#include <sparsepp/spp.h>
#elif DENSE
#include <google/dense_hash_map>
#elif SPARSE
#include <google/sparse_hash_map>
#elif STD
#include <unordered_map>
#endif
using std::make_pair;
template <class T>
void test(T &s, int count)
{
spp::Timer<std::milli> timer;
timer.snap();
srand(0);
for (int i = 0; i < count; ++i)
s.insert(make_pair(rand(), i));
printf("%d random inserts in %5.2f seconds\n", count, timer.get_delta() / 1000);
timer.snap();
srand(0);
for (int i = 0; i < count; ++i)
s.find(rand());
printf("%d random finds in %5.2f seconds\n", count, timer.get_delta() / 1000);
timer.snap();
srand(1);
for (int i = 0; i < count; ++i)
s.find(rand());
printf("%d random not-finds in %5.2f seconds\n", count, timer.get_delta() / 1000);
s.clear();
timer.snap();
srand(0);
for (int i = 0; i < count; ++i)
s.insert(make_pair(i, i));
printf("%d sequential inserts in %5.2f seconds\n", count, timer.get_delta() / 1000);
timer.snap();
srand(0);
for (int i = 0; i < count; ++i)
s.find(i);
printf("%d sequential finds in %5.2f seconds\n", count, timer.get_delta() / 1000);
timer.snap();
srand(1);
for (int i = 0; i < count; ++i)
{
int x = rand();
s.find(x);
}
printf("%d random not-finds in %5.2f seconds\n", count, timer.get_delta() / 1000);
s.clear();
timer.snap();
srand(0);
for (int i = 0; i < count; ++i)
s.insert(make_pair(-i, -i));
printf("%d neg sequential inserts in %5.2f seconds\n", count, timer.get_delta() / 1000);
timer.snap();
srand(0);
for (int i = 0; i < count; ++i)
s.find(-i);
printf("%d neg sequential finds in %5.2f seconds\n", count, timer.get_delta() / 1000);
timer.snap();
srand(1);
for (int i = 0; i < count; ++i)
s.find(rand());
printf("%d random not-finds in %5.2f seconds\n", count, timer.get_delta() / 1000);
s.clear();
}
struct Hasher64 {
size_t operator()(uint64_t k) const { return (k ^ 14695981039346656037ULL) * 1099511628211ULL; }
};
struct Hasher32 {
size_t operator()(uint32_t k) const { return (k ^ 2166136261U) * 16777619UL; }
};
struct Hasheri32 {
size_t operator()(int k) const
{
return (k ^ 2166136261U) * 16777619UL;
}
};
struct Hasher_32 {
size_t operator()(int k) const
{
uint32_t a = (uint32_t)k;
#if 0
a = (a ^ 61) ^ (a >> 16);
a = a + (a << 3);
a = a ^ (a >> 4);
a = a * 0x27d4eb2d;
a = a ^ (a >> 15);
return a;
#else
a = a ^ (a >> 4);
a = (a ^ 0xdeadbeef) + (a << 5);
a = a ^ (a >> 11);
return a;
#endif
}
};
int main()
{
#if SPP
spp::sparse_hash_map<int, int /*, Hasheri32 */> s;
printf ("Testing spp::sparse_hash_map\n");
#elif DENSE
google::dense_hash_map<int, int/* , Hasher_32 */> s;
s.set_empty_key(-INT_MAX);
s.set_deleted_key(-(INT_MAX - 1));
printf ("Testing google::dense_hash_map\n");
#elif SPARSE
google::sparse_hash_map<int, int/* , Hasher_32 */> s;
s.set_deleted_key(-INT_MAX);
printf ("Testing google::sparse_hash_map\n");
#elif STD
std::unordered_map<int, int/* , Hasher_32 */> s;
printf ("Testing std::unordered_map\n");
#endif
printf ("------------------------------\n");
test(s, 50000000);
return 0;
}

189
resources/3rdparty/sparsepp/tests/spp_alloc_test.cc

@ -0,0 +1,189 @@
#include <memory>
#include <cassert>
#include <cstdio>
#include <stdlib.h>
#include <algorithm>
#include <vector>
// enable debugging code in spp_bitset.h
#define SPP_TEST 1
#include <sparsepp/spp_timer.h>
#include <sparsepp/spp_memory.h>
#include <sparsepp/spp_dlalloc.h>
using namespace std;
static float _to_mb(uint64_t m) { return (float)((double)m / (1024 * 1024)); }
// -----------------------------------------------------------
// -----------------------------------------------------------
template <class T, class A>
class TestAlloc
{
public:
TestAlloc(size_t num_alloc = 8000000) :
_num_alloc(num_alloc)
{
_allocated.resize(_num_alloc, nullptr);
_sizes.resize(_num_alloc, 0);
_start_mem_usage = spp::GetProcessMemoryUsed();
}
void run()
{
srand(43); // always same sequence of random numbers
for (size_t i=0; i<_num_alloc; ++i)
_sizes[i] = std::max(2, (rand() % 5) * 2);
spp::Timer<std::milli> timer;
// allocate small buffers
// ----------------------
for (size_t i=0; i<_num_alloc; ++i)
{
_allocated[i] = _allocator.allocate(_sizes[i]);
_set_buf(_allocated[i], _sizes[i]);
}
#if 1
// and grow the buffers to a max size of 24 each
// ---------------------------------------------
for (uint32_t j=4; j<26; j += 2)
{
for (size_t i=0; i<_num_alloc; ++i)
{
// if ( _sizes[i] < j) // windows allocator friendly!
if ((rand() % 4) != 3 && _sizes[i] < j) // really messes up windows allocator
{
_allocated[i] = _allocator.reallocate(_allocated[i], j);
_check_buf(_allocated[i], _sizes[i]);
_set_buf(_allocated[i], j);
_sizes[i] = j;
}
}
}
#endif
#if 0
// test erase (shrinking the buffers)
// ---------------------------------------------
for (uint32_t j=28; j>4; j -= 2)
{
for (size_t i=0; i<_num_alloc; ++i)
{
// if ( _sizes[i] < j) // windows allocator friendly!
if ((rand() % 4) != 3 && _sizes[i] > j) // really messes up windows allocator
{
_allocated[i] = _allocator.reallocate(_allocated[i], j);
_check_buf1(_allocated[i], _sizes[i]);
_set_buf(_allocated[i], j);
_sizes[i] = j;
}
}
}
#endif
#if 0
// and grow the buffers back to a max size of 24 each
// --------------------------------------------------
for (uint32_t j=4; j<26; j += 2)
{
for (size_t i=0; i<_num_alloc; ++i)
{
// if ( _sizes[i] < j) // windows allocator friendly!
if ((rand() % 4) != 3 && _sizes[i] < j) // really messes up windows allocator
{
_allocated[i] = _allocator.reallocate(_allocated[i], j);
_check_buf(_allocated[i], _sizes[i]);
_set_buf(_allocated[i], j);
_sizes[i] = j;
}
}
}
#endif
size_t total_units = 0;
for (size_t i=0; i<_num_alloc; ++i)
total_units += _sizes[i];
uint64_t mem_usage = spp::GetProcessMemoryUsed();
uint64_t alloc_mem_usage = mem_usage - _start_mem_usage;
uint64_t expected_mem_usage = total_units * sizeof(T);
// finally free the memory
// -----------------------
for (size_t i=0; i<_num_alloc; ++i)
{
_check_buf(_allocated[i], _sizes[i]);
_allocator.deallocate(_allocated[i], _sizes[i]);
}
uint64_t mem_usage_end = spp::GetProcessMemoryUsed();
printf("allocated %zd entities of size %zd\n", total_units, sizeof(T));
printf("done in %3.2f seconds, mem_usage %4.1f/%4.1f/%4.1f MB\n",
timer.get_total() / 1000, _to_mb(_start_mem_usage), _to_mb(mem_usage), _to_mb(mem_usage_end));
printf("expected mem usage: %4.1f\n", _to_mb(expected_mem_usage));
if (expected_mem_usage <= alloc_mem_usage)
printf("overhead: %4.1f%%\n",
(float)((double)(alloc_mem_usage - expected_mem_usage) / expected_mem_usage) * 100);
else
printf("bug: alloc_mem_usage <= expected_mem_usage\n");
std::vector<T *>().swap(_allocated);
std::vector<uint32_t>().swap(_sizes);
printf("\nmem usage after freeing vectors: %4.1f\n", _to_mb(spp::GetProcessMemoryUsed()));
}
private:
void _set_buf(T *buff, uint32_t sz) { *buff = (T)sz; buff[sz - 1] = (T)sz; }
void _check_buf1(T *buff, uint32_t sz)
{
assert(*buff == (T)sz);
(void)(buff + sz); // silence warning
}
void _check_buf(T *buff, uint32_t sz)
{
assert(*buff == (T)sz && buff[sz - 1] == (T)sz);
(void)(buff + sz); // silence warning
}
size_t _num_alloc;
uint64_t _start_mem_usage;
std::vector<T *> _allocated;
std::vector<uint32_t> _sizes;
A _allocator;
};
// -----------------------------------------------------------
// -----------------------------------------------------------
template <class X, class A>
void run_test(const char *alloc_name)
{
printf("\n---------------- testing %s\n\n", alloc_name);
printf("\nmem usage before the alloc test: %4.1f\n",
_to_mb(spp::GetProcessMemoryUsed()));
{
TestAlloc< X, A > test_alloc;
test_alloc.run();
}
printf("mem usage after the alloc test: %4.1f\n",
_to_mb(spp::GetProcessMemoryUsed()));
printf("\n\n");
}
// -----------------------------------------------------------
// -----------------------------------------------------------
int main()
{
typedef uint64_t X;
run_test<X, spp::libc_allocator<X>>("libc_allocator");
run_test<X, spp::spp_allocator<X>>("spp_allocator");
}

284
resources/3rdparty/sparsepp/tests/spp_bitset_test.cc

@ -0,0 +1,284 @@
#include <memory>
#include <cassert>
#include <cstdio>
#include <stdlib.h>
#include <algorithm>
#include <vector>
// enable debugging code in spp_bitset.h
#define SPP_TEST 1
#include <sparsepp/spp_timer.h>
#include <sparsepp/spp_memory.h>
#include <sparsepp/spp_bitset.h>
using namespace std;
// -----------------------------------------------------------
// -----------------------------------------------------------
template <size_t N>
class TestBitset
{
public:
typedef spp::spp_bitset<N> BS;
TestBitset()
{}
void test_set(size_t num_iter)
{
size_t num_errors = 0;
BS bs, bs2;
printf("testing set on spp_bitset<%zu> , num_iter=%6zu -> ", N, num_iter);
for (size_t i=0; i<num_iter; ++i)
{
bs.reset();
bs2.reset();
size_t start = rand() % N;
size_t to = start + rand() % (N - start);
bs.set(start, to);
bs2.set_naive(start, to);
bool same = bs == bs2;
if (!same)
++num_errors;
assert(same);
}
printf("num_errors = %zu\n", num_errors);
}
void test_reset(size_t num_iter)
{
size_t num_errors = 0;
BS bs, bs2;
printf("testing reset on spp_bitset<%zu>, num_iter=%6zu -> ", N, num_iter);
for (size_t i=0; i<num_iter; ++i)
{
bs.set();
bs2.set();
size_t start = rand() % N;
size_t to = start + rand() % (N - start);
bs.reset(start, to);
bs2.reset_naive(start, to);
bool same = bs == bs2;
if (!same)
++num_errors;
assert(same);
}
printf("num_errors = %zu\n", num_errors);
}
void test_all(size_t num_iter)
{
size_t num_errors = 0;
BS bs;
printf("testing all() on spp_bitset<%zu>, num_iter=%6zu -> ", N, num_iter);
for (size_t i=0; i<4 * N; ++i)
{
bs.set(rand() % N);
if (i > 2 * N)
{
for (size_t j=0; j<num_iter; ++j)
{
size_t start = rand() % N;
size_t to = start + rand() % (N - start);
bool same = bs.all(start, to) == bs.all_naive(start, to);
if (!same)
++num_errors;
assert(same);
}
size_t start = 0, start_naive = 1;
bs.all(start);
bs.all_naive(start_naive);
bool same = (start == start_naive);
if (!same)
++num_errors;
assert(same);
}
}
printf("num_errors = %zu\n", num_errors);
}
void test_any(size_t num_iter)
{
size_t num_errors = 0;
BS bs;
printf("testing any() on spp_bitset<%zu>, num_iter=%6zu -> ", N, num_iter);
for (size_t i=0; i<num_iter; ++i)
{
bs.set(rand() % N);
for (size_t j=0; j<100; ++j)
{
size_t start = rand() % N;
size_t to = start + rand() % (N - start);
bool same = bs.any(start, to) == bs.any_naive(start, to);
if (!same)
++num_errors;
assert(same);
}
}
printf("num_errors = %zu\n", num_errors);
}
void test_longest(size_t num_iter)
{
size_t num_errors = 0;
BS bs, bs2;
assert(bs.longest_zero_sequence() == N);
bs.set(0);
assert(bs.longest_zero_sequence() == N-1);
bs.set(10);
assert(bs.find_next_n(3, 8) == 11);
assert(bs.find_next_n(3, 6) == 6);
assert(bs.find_next_n(3, N-2) == 1);
assert(bs.longest_zero_sequence() == N-11);
if (N > 1000)
{
bs.set(1000);
size_t longest = bs.longest_zero_sequence();
assert(longest == 1000-11 || longest == N-1001);
if (!(longest == 1000-11 || longest == N-1001))
++num_errors;
}
spp::Timer<std::milli> timer_lz;
spp::Timer<std::milli> timer_lz_slow;
float lz_time(0), lz_time_slow(0);
printf("testing longest_zero_sequence() , num_iter=%6zu -> ", num_iter);
srand(1);
for (size_t i=0; i<num_iter; ++i)
{
bs.reset();
for (size_t j=0; j<N; ++j)
{
bs.set(rand() % N);
timer_lz.snap();
size_t lz1 = bs.longest_zero_sequence();
lz_time += timer_lz.get_delta();
timer_lz_slow.snap();
size_t lz2 = bs.longest_zero_sequence_naive();
lz_time_slow += timer_lz_slow.get_delta();
num_errors += (lz1 != lz2);
assert(!num_errors);
}
}
printf("num_errors = %zu, time=%7.1f, slow_time=%7.1f\n", num_errors, lz_time, lz_time_slow);
}
void test_longest2(size_t num_iter)
{
size_t num_errors = 0;
BS bs, bs2;
assert(bs.longest_zero_sequence() == N);
bs.set(0);
assert(bs.longest_zero_sequence() == N-1);
bs.set(10);
assert(bs.find_next_n(3, 8) == 11);
assert(bs.find_next_n(3, 6) == 6);
assert(bs.find_next_n(3, N-2) == 1);
assert(bs.longest_zero_sequence() == N-11);
if (N > 1000)
{
bs.set(1000);
size_t longest = bs.longest_zero_sequence();
assert(longest == 1000-11 || longest == N-1001);
if (!(longest == 1000-11 || longest == N-1001))
++num_errors;
}
spp::Timer<std::milli> timer_lz;
spp::Timer<std::milli> timer_lz_slow;
float lz_time(0), lz_time_slow(0);
printf("testing longest_zero_sequence2() , num_iter=%6zu -> ", num_iter);
srand(1);
for (size_t i=0; i<num_iter; ++i)
{
bs.reset();
for (size_t j=0; j<N; ++j)
{
bs.set(rand() % N);
size_t start_pos1 = 0, start_pos2 = 0;
timer_lz.snap();
size_t lz1 = bs.longest_zero_sequence(64, start_pos1);
lz_time += timer_lz.get_delta();
timer_lz_slow.snap();
size_t lz2 = bs.longest_zero_sequence_naive(64, start_pos2);
lz_time_slow += timer_lz_slow.get_delta();
assert(start_pos1 == start_pos2);
num_errors += (lz1 != lz2) || (start_pos1 != start_pos2);
assert(!num_errors);
}
}
printf("num_errors = %zu, time=%7.1f, slow_time=%7.1f\n", num_errors, lz_time, lz_time_slow);
}
void test_ctz(size_t num_iter)
{
size_t num_errors = 0;
spp::Timer<std::milli> timer_ctz;
spp::Timer<std::milli> timer_ctz_slow;
float ctz_time(0), ctz_time_slow(0);
printf("testing count_trailing_zeroes() , num_iter=%6zu -> ", num_iter);
for (size_t i=0; i<num_iter; ++i)
{
size_t v = rand() ^ (rand() << 16);
timer_ctz.snap();
uint32_t ctz1 = spp::count_trailing_zeroes(v);
ctz_time += timer_ctz.get_delta();
timer_ctz_slow.snap();
size_t ctz2 = spp::count_trailing_zeroes_naive(v);
ctz_time_slow += timer_ctz_slow.get_delta();
num_errors += (ctz1 != ctz2);
assert(!num_errors);
}
printf("num_errors = %zu, time=%7.1f, slow_time=%7.1f\n", num_errors, ctz_time, ctz_time_slow);
}
void run()
{
test_ctz(10000);
test_all(10000);
test_any(1000);
test_set(1000);
test_reset(1000);
test_longest(200);
test_longest2(200);
}
};
// -----------------------------------------------------------
// -----------------------------------------------------------
int main()
{
TestBitset<1024> test_bitset_1024;
test_bitset_1024.run();
TestBitset<4096> test_bitset_4096;
test_bitset_4096.run();
//TestBitset<8192> test_bitset_8192;
//test_bitset_8192.run();
}

2988
resources/3rdparty/sparsepp/tests/spp_test.cc
File diff suppressed because it is too large
View File

38
resources/3rdparty/sparsepp/tests/vsprojects/spp.sln

@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spp_test", "spp_test.vcxproj", "{9863A521-E9DB-4775-A276-CADEF726CF11}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spp_alloc_test", "spp_alloc_test.vcxproj", "{19BC4240-15ED-4C76-BC57-34BB70FE163B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9863A521-E9DB-4775-A276-CADEF726CF11}.Debug|x64.ActiveCfg = Debug|x64
{9863A521-E9DB-4775-A276-CADEF726CF11}.Debug|x64.Build.0 = Debug|x64
{9863A521-E9DB-4775-A276-CADEF726CF11}.Debug|x86.ActiveCfg = Debug|Win32
{9863A521-E9DB-4775-A276-CADEF726CF11}.Debug|x86.Build.0 = Debug|Win32
{9863A521-E9DB-4775-A276-CADEF726CF11}.Release|x64.ActiveCfg = Release|x64
{9863A521-E9DB-4775-A276-CADEF726CF11}.Release|x64.Build.0 = Release|x64
{9863A521-E9DB-4775-A276-CADEF726CF11}.Release|x86.ActiveCfg = Release|Win32
{9863A521-E9DB-4775-A276-CADEF726CF11}.Release|x86.Build.0 = Release|Win32
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Debug|x64.ActiveCfg = Debug|x64
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Debug|x64.Build.0 = Debug|x64
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Debug|x86.ActiveCfg = Debug|Win32
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Debug|x86.Build.0 = Debug|Win32
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Release|x64.ActiveCfg = Release|x64
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Release|x64.Build.0 = Release|x64
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Release|x86.ActiveCfg = Release|Win32
{19BC4240-15ED-4C76-BC57-34BB70FE163B}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

176
resources/3rdparty/sparsepp/tests/vsprojects/spp_alloc_test.vcxproj

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\spp_alloc_test.cc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\sparsepp\spp.h" />
<ClInclude Include="..\..\sparsepp\spp_alloc.h" />
<ClInclude Include="..\..\sparsepp\spp_bitset.h" />
<ClInclude Include="..\..\sparsepp\spp_memory.h" />
<ClInclude Include="..\..\sparsepp\spp_timer.h" />
<ClInclude Include="..\..\sparsepp\spp_utils.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{19BC4240-15ED-4C76-BC57-34BB70FE163B}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>14.0.23107.0</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_alloc_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)spp_alloc_test.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_alloc_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)spp_alloc_test.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_alloc_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_alloc_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<Profile>true</Profile>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

28
resources/3rdparty/sparsepp/tests/vsprojects/spp_alloc_test.vcxproj.filters

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{c644622a-f598-4fcf-861c-199b4b988881}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\sparsepp\spp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\sparsepp\spp_alloc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\sparsepp\spp_bitset.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\sparsepp\spp_memory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\sparsepp\spp_timer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\sparsepp\spp_utils.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

175
resources/3rdparty/sparsepp/tests/vsprojects/spp_test.vcxproj

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\spp_test.cc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\sparsepp\spp.h" />
<ClInclude Include="..\..\sparsepp\spp_alloc.h" />
<ClInclude Include="..\..\sparsepp\spp_bitset.h" />
<ClInclude Include="..\..\sparsepp\spp_memory.h" />
<ClInclude Include="..\..\sparsepp\spp_timer.h" />
<ClInclude Include="..\..\sparsepp\spp_utils.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9863A521-E9DB-4775-A276-CADEF726CF11}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>14.0.23107.0</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup>
<IntDirSharingDetected>None</IntDirSharingDetected>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)spp_test.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>EnableAllWarnings</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)spp_test.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<OutputFile>$(OutDir)spp_test.exe</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

32
resources/3rdparty/sparsepp/tests/vsprojects/spp_test.vcxproj.filters

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\spp_test.cc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\sparsepp\spp.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\sparsepp\spp_alloc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\sparsepp\spp_bitset.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\sparsepp\spp_memory.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\sparsepp\spp_timer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\sparsepp\spp_utils.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
Loading…
Cancel
Save