change style for constants

master
Daniel Kolesa 2016-01-22 18:12:39 +00:00
parent eaaddb0d0b
commit d1feaafb5e
2 changed files with 16 additions and 16 deletions

View File

@ -33,9 +33,9 @@ enum class FileType {
struct FileInfo; struct FileInfo;
#ifdef OSTD_PLATFORM_WIN32 #ifdef OSTD_PLATFORM_WIN32
static constexpr char PATH_SEPARATOR = '\\'; static constexpr char PathSeparator = '\\';
#else #else
static constexpr char PATH_SEPARATOR = '/'; static constexpr char PathSeparator = '/';
#endif #endif
#ifdef OSTD_PLATFORM_WIN32 #ifdef OSTD_PLATFORM_WIN32
@ -148,7 +148,7 @@ private:
p_path = path; p_path = path;
ConstCharRange r = p_path.iter(); ConstCharRange r = p_path.iter();
ConstCharRange found = find_last(r, PATH_SEPARATOR); ConstCharRange found = find_last(r, PathSeparator);
if (found.empty()) if (found.empty())
p_slash = npos; p_slash = npos;
else else
@ -326,7 +326,7 @@ private:
if (!p_de) if (!p_de)
return FileInfo(); return FileInfo();
String ap = p_path; String ap = p_path;
ap += PATH_SEPARATOR; ap += PathSeparator;
ap += (const char *)p_de->d_name; ap += (const char *)p_de->d_name;
return FileInfo(ap); return FileInfo(ap);
} }
@ -464,7 +464,7 @@ private:
if (empty()) if (empty())
return FileInfo(); return FileInfo();
String ap = p_path; String ap = p_path;
ap += PATH_SEPARATOR; ap += PathSeparator;
ap += (const char *)p_data.cFileName; ap += (const char *)p_data.cFileName;
return FileInfo(ap); return FileInfo(ap);
} }
@ -516,7 +516,7 @@ namespace detail {
template<typename T, typename ...A> template<typename T, typename ...A>
static void join(String &s, const T &a, const A &...b) { static void join(String &s, const T &a, const A &...b) {
s += a; s += a;
s += PATH_SEPARATOR; s += PathSeparator;
PathJoin<I - 1>::join(s, b...); PathJoin<I - 1>::join(s, b...);
} }
}; };

View File

@ -121,21 +121,21 @@ public:
namespace detail { namespace detail {
/* Use template metaprogramming to figure out a correct number /* Use template metaprogramming to figure out a correct number
* of elements to use per chunk for proper cache alignment * of elements to use per chunk for proper cache alignment
* (i.e. sizeof(Chunk) % CACHE_LINE_SIZE == 0). * (i.e. sizeof(Chunk) % CacheLineSize == 0).
* *
* If this is not possible, use the upper bound and pad the * If this is not possible, use the upper bound and pad the
* structure with some extra bytes. * structure with some extra bytes.
*/ */
static constexpr Size CACHE_LINE_SIZE = 64; static constexpr Size CacheLineSize = 64;
static constexpr Size CHUNK_LOWER_BOUND = 32; static constexpr Size ChunkLowerBound = 32;
static constexpr Size CHUNK_UPPER_BOUND = 128; static constexpr Size ChunkUpperBound = 128;
template<typename E, Size N> constexpr Size HashChainAlign template<typename E, Size N> constexpr Size HashChainAlign
= (((sizeof(HashChain<E>[N]) + sizeof(void *)) % CACHE_LINE_SIZE) == 0) = (((sizeof(HashChain<E>[N]) + sizeof(void *)) % CacheLineSize) == 0)
? N : HashChainAlign<E, N + 1>; ? N : HashChainAlign<E, N + 1>;
template<typename E> template<typename E>
constexpr Size HashChainAlign<E, CHUNK_UPPER_BOUND> = CHUNK_UPPER_BOUND; constexpr Size HashChainAlign<E, ChunkUpperBound> = ChunkUpperBound;
template<Size N, bool B> template<Size N, bool B>
struct HashChainPad; struct HashChainPad;
@ -145,14 +145,14 @@ namespace detail {
template<Size N> template<Size N>
struct HashChainPad<N, false> { struct HashChainPad<N, false> {
byte pad[CACHE_LINE_SIZE - (N % CACHE_LINE_SIZE)]; byte pad[CacheLineSize - (N % CacheLineSize)];
}; };
template<Size N> template<Size N>
struct HashPad: HashChainPad<N, N % CACHE_LINE_SIZE == 0> {}; struct HashPad: HashChainPad<N, N % CacheLineSize == 0> {};
template<typename E, Size V = HashChainAlign<E, CHUNK_LOWER_BOUND>, template<typename E, Size V = HashChainAlign<E, ChunkLowerBound>,
bool P = (V == CHUNK_UPPER_BOUND) bool P = (V == ChunkUpperBound)
> struct HashChunk; > struct HashChunk;
template<typename E, Size V> template<typename E, Size V>