diff options
author | u <u@noreply.codeberg.org> | 2020-11-11 03:32:05 +0100 |
---|---|---|
committer | u <u@noreply.codeberg.org> | 2020-11-11 03:32:05 +0100 |
commit | 359887b8afb8892f01f72a05ff63a88a6ffa9f4f (patch) | |
tree | 3e29683931748021dbcdfcf2d8e88541b221e082 /tool/PGListUtil/src/common/common.h | |
parent | ab384049a1eda8c7676ef93771e0e040f08c880f (diff) | |
parent | b346040be73f9e28998fde6fc27467ff24c0abad (diff) | |
download | cloudflare-tor-359887b8afb8892f01f72a05ff63a88a6ffa9f4f.tar.lz cloudflare-tor-359887b8afb8892f01f72a05ff63a88a6ffa9f4f.tar.xz cloudflare-tor-359887b8afb8892f01f72a05ff63a88a6ffa9f4f.zip |
🙆
Diffstat (limited to 'tool/PGListUtil/src/common/common.h')
-rw-r--r-- | tool/PGListUtil/src/common/common.h | 48 |
1 files changed, 48 insertions, 0 deletions
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 <boost/cstdint.hpp>
+
+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
|