]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/BrotliCustomDecompressLib/common/types.h
MdeModulePkg: Copy Brotli algorithm 3rd party source code for library
[mirror_edk2.git] / MdeModulePkg / Library / BrotliCustomDecompressLib / common / types.h
diff --git a/MdeModulePkg/Library/BrotliCustomDecompressLib/common/types.h b/MdeModulePkg/Library/BrotliCustomDecompressLib/common/types.h
new file mode 100644 (file)
index 0000000..c6a37a6
--- /dev/null
@@ -0,0 +1,58 @@
+/* Copyright 2013 Google Inc. All Rights Reserved.\r
+\r
+   Distributed under MIT license.\r
+   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT\r
+*/\r
+\r
+/* Common types */\r
+\r
+#ifndef BROTLI_COMMON_TYPES_H_\r
+#define BROTLI_COMMON_TYPES_H_\r
+\r
+#include <stddef.h>  /* for size_t */\r
+\r
+#if defined(_MSC_VER) && (_MSC_VER < 1600)\r
+typedef __int8 int8_t;\r
+typedef unsigned __int8 uint8_t;\r
+typedef __int16 int16_t;\r
+typedef unsigned __int16 uint16_t;\r
+typedef __int32 int32_t;\r
+typedef unsigned __int32 uint32_t;\r
+typedef unsigned __int64 uint64_t;\r
+typedef __int64 int64_t;\r
+#else\r
+#include <stdint.h>\r
+#endif  /* defined(_MSC_VER) && (_MSC_VER < 1600) */\r
+\r
+#if (!defined(_MSC_VER) || (_MSC_VER >= 1800)) && \\r
+  (defined(__cplusplus) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L))\r
+#include <stdbool.h>\r
+#define BROTLI_BOOL bool\r
+#define BROTLI_TRUE true\r
+#define BROTLI_FALSE false\r
+#define TO_BROTLI_BOOL(X) (!!(X))\r
+#else\r
+typedef enum {\r
+  BROTLI_FALSE = 0,\r
+  BROTLI_TRUE = !BROTLI_FALSE\r
+} BROTLI_BOOL;\r
+#define TO_BROTLI_BOOL(X) (!!(X) ? BROTLI_TRUE : BROTLI_FALSE)\r
+#endif\r
+\r
+#define MAKE_UINT64_T(high, low) ((((uint64_t)(high)) << 32) | low)\r
+\r
+#define BROTLI_UINT32_MAX (~((uint32_t)0))\r
+#define BROTLI_SIZE_MAX (~((size_t)0))\r
+\r
+/* Allocating function pointer. Function MUST return 0 in the case of failure.\r
+   Otherwise it MUST return a valid pointer to a memory region of at least\r
+   size length. Neither items nor size are allowed to be 0.\r
+   opaque argument is a pointer provided by client and could be used to bind\r
+   function to specific object (memory pool). */\r
+typedef void* (*brotli_alloc_func)(void* opaque, size_t size);\r
+\r
+/* Deallocating function pointer. Function SHOULD be no-op in the case the\r
+   address is 0. */\r
+typedef void (*brotli_free_func)(void* opaque, void* address);\r
+\r
+#endif  /* BROTLI_COMMON_TYPES_H_ */\r