]> git.proxmox.com Git - rustc.git/blame - src/llvm/include/llvm/Support/Compression.h
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / include / llvm / Support / Compression.h
CommitLineData
1a4d82fc
JJ
1//===-- 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
85aaf69f 17#include "llvm/ADT/SmallVector.h"
1a4d82fc
JJ
18#include "llvm/Support/DataTypes.h"
19#include <memory>
1a4d82fc
JJ
20
21namespace llvm {
22
23class StringRef;
24
25namespace zlib {
26
27enum CompressionLevel {
28 NoCompression,
29 DefaultCompression,
30 BestSpeedCompression,
31 BestSizeCompression
32};
33
34enum Status {
35 StatusOK,
36 StatusUnsupported, // zlib is unavailable
37 StatusOutOfMemory, // there was not enough memory
38 StatusBufferTooShort, // there was not enough room in the output buffer
39 StatusInvalidArg, // invalid input parameter
40 StatusInvalidData // data was corrupted or incomplete
41};
42
43bool isAvailable();
44
45Status compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer,
46 CompressionLevel Level = DefaultCompression);
47
48Status uncompress(StringRef InputBuffer,
49 SmallVectorImpl<char> &UncompressedBuffer,
50 size_t UncompressedSize);
51
52uint32_t crc32(StringRef Buffer);
53
54} // End of namespace zlib
55
56} // End of namespace llvm
57
58#endif
59