diff --git a/deps/lib/nt_i386/release/libbz2.a b/deps/lib/nt_i386/release/libbz2.a index fe50653bd4de9c45d8df7bcc3969613fc5bff42e..3c57e18d6c0e0157adeda2676965de45899dac71 100644 Binary files a/deps/lib/nt_i386/release/libbz2.a and b/deps/lib/nt_i386/release/libbz2.a differ diff --git a/deps/lib/nt_i386/release/libglfw-nt.a b/deps/lib/nt_i386/release/libglfw-nt.a new file mode 100644 index 0000000000000000000000000000000000000000..d363a3caadcfd424c45b62c0a415311326918375 Binary files /dev/null and b/deps/lib/nt_i386/release/libglfw-nt.a differ diff --git a/src/CFGFileParser.cpp b/src/CFGFileParser.cpp index 8291e0601f560975e5d0f156ada240a3e9019a5d..42d0659fb91d0051a93a22aa2161a51ab9e5f975 100644 --- a/src/CFGFileParser.cpp +++ b/src/CFGFileParser.cpp @@ -18,10 +18,13 @@ CFGFileParser::~CFGFileParser() tlsf_free(buffer); } -namespace despair{ +namespace ntr{ size_t string_hash(const fast_string &str) { size_t out = 0; +// instead of tying this to i386/amd64 +// because someone is eventually going to +// port this to ARM or some RISC nonsense #if UINTPTR_MAX == 0xffffffff MurmurHash3_x86_128 ( &str, sizeof(str), 7904542L, &out ); #elif UINTPTR_MAX == 0xffffffffffffffff diff --git a/src/CFGFileParser.h b/src/CFGFileParser.h index 914fb0d628d7d6997a0c7b5ab4f060d4ba9930ef..535acffe7dd9dbc3a4eb83fc00ad20212b773306 100644 --- a/src/CFGFileParser.h +++ b/src/CFGFileParser.h @@ -12,9 +12,9 @@ #include <cstdint> // let's try fast strings -typedef std::basic_string<char, std::char_traits<char>, despair::TLSFAlloc<char>> fast_string; -namespace despair{ size_t string_hash(const fast_string &str); bool fast_string_compare(fast_string t1, fast_string t2); } -typedef std::unordered_map<fast_string,fast_string,std::function<decltype(despair::string_hash)>,std::function<decltype(despair::fast_string_compare)>,despair::TLSFAlloc<std::pair<const fast_string, fast_string>>> stringmap; +typedef std::basic_string<char, std::char_traits<char>, ntr::TLSFAlloc<char>> fast_string; +namespace ntr{ size_t string_hash(const fast_string &str); bool fast_string_compare(fast_string t1, fast_string t2); } +typedef std::unordered_map<fast_string,fast_string,std::function<decltype(ntr::string_hash)>,std::function<decltype(ntr::fast_string_compare)>,ntr::TLSFAlloc<std::pair<const fast_string, fast_string>>> stringmap; // Class which holds the parsed configuration options after // being processed by CFGFileParser. No longer a "trivial class" @@ -22,8 +22,14 @@ typedef std::unordered_map<fast_string,fast_string,std::function<decltype(despai struct BrowserConfiguration{ stringmap GlobalSettings; // fast allocation! - static void* operator new(std::size_t n) { if (void *mem = tlsf_malloc(n)) return mem; throw std::bad_alloc {}; } - static void operator delete(void *p){tlsf_free(p);} + static void* operator new(std::size_t n){ + if (void *mem = tlsf_malloc(n)){ + return mem; + } throw std::bad_alloc {}; + } + static void operator delete(void *p){ + tlsf_free(p); + } void clear(); }; diff --git a/src/TLSFAlloc.h b/src/TLSFAlloc.h index a4ad820ffb37b38ee609b3d6ad451ef6d8b60fa6..ac0ec4264aaae1cec66ba540992f4a658eeb4473 100644 --- a/src/TLSFAlloc.h +++ b/src/TLSFAlloc.h @@ -6,7 +6,7 @@ #include <iostream> #include "tlsf.h" -namespace despair { +namespace ntr { template <class T> class TLSFAlloc { public: