Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===-- llvm/Support/Compression.h ---Compression----------------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame^] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file contains basic functions for compression/uncompression. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef LLVM_SUPPORT_COMPRESSION_H |
| 14 | #define LLVM_SUPPORT_COMPRESSION_H |
| 15 | |
| 16 | #include "llvm/Support/DataTypes.h" |
| 17 | |
| 18 | namespace llvm { |
| 19 | template <typename T> class SmallVectorImpl; |
| 20 | class Error; |
| 21 | class StringRef; |
| 22 | |
| 23 | namespace zlib { |
| 24 | |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 25 | static constexpr int NoCompression = 0; |
| 26 | static constexpr int BestSpeedCompression = 1; |
| 27 | static constexpr int DefaultCompression = 6; |
| 28 | static constexpr int BestSizeCompression = 9; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 29 | |
| 30 | bool isAvailable(); |
| 31 | |
| 32 | Error compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer, |
Andrew Scull | cdfcccc | 2018-10-05 20:58:37 +0100 | [diff] [blame] | 33 | int Level = DefaultCompression); |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 34 | |
| 35 | Error uncompress(StringRef InputBuffer, char *UncompressedBuffer, |
| 36 | size_t &UncompressedSize); |
| 37 | |
| 38 | Error uncompress(StringRef InputBuffer, |
| 39 | SmallVectorImpl<char> &UncompressedBuffer, |
| 40 | size_t UncompressedSize); |
| 41 | |
| 42 | uint32_t crc32(StringRef Buffer); |
| 43 | |
| 44 | } // End of namespace zlib |
| 45 | |
| 46 | } // End of namespace llvm |
| 47 | |
| 48 | #endif |