]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/BrotliCompress/enc/write_bits.h
BaseTools: Make brotli a submodule
[mirror_edk2.git] / BaseTools / Source / C / BrotliCompress / enc / write_bits.h
diff --git a/BaseTools/Source/C/BrotliCompress/enc/write_bits.h b/BaseTools/Source/C/BrotliCompress/enc/write_bits.h
deleted file mode 100644 (file)
index 1269b28..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/* Copyright 2010 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
-/* Write bits into a byte array. */\r
-\r
-#ifndef BROTLI_ENC_WRITE_BITS_H_\r
-#define BROTLI_ENC_WRITE_BITS_H_\r
-\r
-#include "../common/platform.h"\r
-#include <brotli/types.h>\r
-\r
-#if defined(__cplusplus) || defined(c_plusplus)\r
-extern "C" {\r
-#endif\r
-\r
-/*#define BIT_WRITER_DEBUG */\r
-\r
-/* This function writes bits into bytes in increasing addresses, and within\r
-   a byte least-significant-bit first.\r
-\r
-   The function can write up to 56 bits in one go with WriteBits\r
-   Example: let's assume that 3 bits (Rs below) have been written already:\r
-\r
-   BYTE-0     BYTE+1       BYTE+2\r
-\r
-   0000 0RRR    0000 0000    0000 0000\r
-\r
-   Now, we could write 5 or less bits in MSB by just sifting by 3\r
-   and OR'ing to BYTE-0.\r
-\r
-   For n bits, we take the last 5 bits, OR that with high bits in BYTE-0,\r
-   and locate the rest in BYTE+1, BYTE+2, etc. */\r
-static BROTLI_INLINE void BrotliWriteBits(size_t n_bits,\r
-                                          uint64_t bits,\r
-                                          size_t* BROTLI_RESTRICT pos,\r
-                                          uint8_t* BROTLI_RESTRICT array) {\r
-#if defined(BROTLI_LITTLE_ENDIAN)\r
-  /* This branch of the code can write up to 56 bits at a time,\r
-     7 bits are lost by being perhaps already in *p and at least\r
-     1 bit is needed to initialize the bit-stream ahead (i.e. if 7\r
-     bits are in *p and we write 57 bits, then the next write will\r
-     access a byte that was never initialized). */\r
-  uint8_t* p = &array[*pos >> 3];\r
-  uint64_t v = (uint64_t)(*p);  /* Zero-extend 8 to 64 bits. */\r
-  BROTLI_LOG(("WriteBits  %2d  0x%08x%08x  %10d\n", (int)n_bits,\r
-      (uint32_t)(bits >> 32), (uint32_t)(bits & 0xFFFFFFFF),\r
-      (int)*pos));\r
-  BROTLI_DCHECK((bits >> n_bits) == 0);\r
-  BROTLI_DCHECK(n_bits <= 56);\r
-  v |= bits << (*pos & 7);\r
-  BROTLI_UNALIGNED_STORE64LE(p, v);  /* Set some bits. */\r
-  *pos += n_bits;\r
-#else\r
-  /* implicit & 0xFF is assumed for uint8_t arithmetics */\r
-  uint8_t* array_pos = &array[*pos >> 3];\r
-  const size_t bits_reserved_in_first_byte = (*pos & 7);\r
-  size_t bits_left_to_write;\r
-  bits <<= bits_reserved_in_first_byte;\r
-  *array_pos++ |= (uint8_t)bits;\r
-  for (bits_left_to_write = n_bits + bits_reserved_in_first_byte;\r
-       bits_left_to_write >= 9;\r
-       bits_left_to_write -= 8) {\r
-    bits >>= 8;\r
-    *array_pos++ = (uint8_t)bits;\r
-  }\r
-  *array_pos = 0;\r
-  *pos += n_bits;\r
-#endif\r
-}\r
-\r
-static BROTLI_INLINE void BrotliWriteBitsPrepareStorage(\r
-    size_t pos, uint8_t* array) {\r
-  BROTLI_LOG(("WriteBitsPrepareStorage            %10d\n", (int)pos));\r
-  BROTLI_DCHECK((pos & 7) == 0);\r
-  array[pos >> 3] = 0;\r
-}\r
-\r
-#if defined(__cplusplus) || defined(c_plusplus)\r
-}  /* extern "C" */\r
-#endif\r
-\r
-#endif  /* BROTLI_ENC_WRITE_BITS_H_ */\r