From 69595de83bf0429c67cc25a6e3651f3f1e0d1f04 Mon Sep 17 00:00:00 2001 From: katze Date: Wed, 11 Nov 2020 02:46:54 +0100 Subject: Upload files to 'tool/PGListUtil/src/common' --- tool/PGListUtil/src/common/common.h | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 tool/PGListUtil/src/common/common.h (limited to 'tool/PGListUtil/src/common/common.h') diff --git a/tool/PGListUtil/src/common/common.h b/tool/PGListUtil/src/common/common.h new file mode 100644 index 00000000..60530d5b --- /dev/null +++ b/tool/PGListUtil/src/common/common.h @@ -0,0 +1,48 @@ +#ifndef COMMON_H +#define COMMON_H + +#ifdef _MSC_VER + +typedef unsigned __int8 uchar; +typedef unsigned __int32 uint; +typedef unsigned __int64 ulong; + +# else + +#include + +typedef uint8_t uchar; +typedef uint32_t uint; +typedef uint64_t ulong; + +#endif + +namespace pglu { + +#define PGLU_LENGTH_FILELINE 1024 + +inline uint ParseDigit3(const char *begin, const char *end) { + switch(end - begin) { + case 3: + return ((*begin & 0xF) * 100) + ((*(begin + 1) & 0xF) * 10) + (*(begin + 2) & 0xF); + case 2: + return ((*begin & 0xF) * 10) + (*(begin + 1) & 0xF); + case 1: + return (*begin & 0xF); + default: + return 256; + } +} + +#ifdef __MINGW32__ + +inline void ZeroString(char *str) { + while(*str != '\0') + *(str++) = '\0'; +} + +#endif + +} // namespace pglu + +#endif // COMMON_H -- cgit v1.2.3