blob: f7258f4bf8f825b78f614c1a09950bccac46c619 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===-- llvm/Support/Compression.h ---Compression----------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains basic functions for compression/uncompression.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_SUPPORT_COMPRESSION_H
15#define LLVM_SUPPORT_COMPRESSION_H
16
17#include "llvm/Support/DataTypes.h"
18
19namespace llvm {
20template <typename T> class SmallVectorImpl;
21class Error;
22class StringRef;
23
24namespace zlib {
25
Andrew Scullcdfcccc2018-10-05 20:58:37 +010026static constexpr int NoCompression = 0;
27static constexpr int BestSpeedCompression = 1;
28static constexpr int DefaultCompression = 6;
29static constexpr int BestSizeCompression = 9;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010030
31bool isAvailable();
32
33Error compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer,
Andrew Scullcdfcccc2018-10-05 20:58:37 +010034 int Level = DefaultCompression);
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010035
36Error uncompress(StringRef InputBuffer, char *UncompressedBuffer,
37 size_t &UncompressedSize);
38
39Error uncompress(StringRef InputBuffer,
40 SmallVectorImpl<char> &UncompressedBuffer,
41 size_t UncompressedSize);
42
43uint32_t crc32(StringRef Buffer);
44
45} // End of namespace zlib
46
47} // End of namespace llvm
48
49#endif