From 4abe017bc5ec2df97c69355dc0e129d1a2401827 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 5 Mar 2019 17:04:54 -0800 Subject: [PATCH] cleanup MaterialChunkType.h --- .../include/filament/MaterialChunkType.h | 31 ++----------------- tools/matinfo/src/main.cpp | 11 +++++++ 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/libs/filabridge/include/filament/MaterialChunkType.h b/libs/filabridge/include/filament/MaterialChunkType.h index cca41e1f3b..c899cf59bf 100644 --- a/libs/filabridge/include/filament/MaterialChunkType.h +++ b/libs/filabridge/include/filament/MaterialChunkType.h @@ -14,14 +14,12 @@ * limitations under the License. */ -#ifndef TNT_FILAMAT_FILAFLAT_DEFS_H -#define TNT_FILAMAT_FILAFLAT_DEFS_H +#ifndef TNT_FILAMAT_MATERIAL_CHUNK_TYPES_H +#define TNT_FILAMAT_MATERIAL_CHUNK_TYPES_H #include -#include #include -#include namespace filamat { @@ -38,17 +36,6 @@ constexpr inline uint64_t charTo64bitNum(const char str[9]) noexcept { | ( static_cast(str[7]) & 0x00000000000000FFU); } -// Unpack a 64 bit integer into a std::string -inline utils::CString typeToString(uint64_t v) { - uint8_t* raw = (uint8_t*) &v; - char str[9]; - for (size_t i = 0; i < 8; i++) { - str[7 - i] = raw[i]; - } - str[8] = '\0'; - return utils::CString(str, 7); -} - enum UTILS_PUBLIC ChunkType : uint64_t { Unknown = charTo64bitNum("UNKNOWN "), MaterialUib = charTo64bitNum("MAT_UIB "), @@ -94,16 +81,4 @@ enum UTILS_PUBLIC ChunkType : uint64_t { } // namespace filamat -// Custom specialization of std::hash can be injected in namespace std. -// In some build environments, std::hash doesn't default. -// to std::hash. -namespace std { -template<> -struct hash { - std::size_t operator()(filamat::ChunkType chunkType) const noexcept { - return std::hash()(chunkType); - } -}; -} - -#endif +#endif // TNT_FILAMAT_MATERIAL_CHUNK_TYPES_H diff --git a/tools/matinfo/src/main.cpp b/tools/matinfo/src/main.cpp index 73b4955dec..441426760e 100644 --- a/tools/matinfo/src/main.cpp +++ b/tools/matinfo/src/main.cpp @@ -597,6 +597,17 @@ static bool printParametersInfo(ChunkContainer container) { return true; } +// Unpack a 64 bit integer into a std::string +inline utils::CString typeToString(uint64_t v) { + uint8_t* raw = (uint8_t*) &v; + char str[9]; + for (size_t i = 0; i < 8; i++) { + str[7 - i] = raw[i]; + } + str[8] = '\0'; + return utils::CString(str, 7); +} + static void printChunks(const ChunkContainer& container) { std::cout << "Chunks:" << std::endl;