Compression.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //===-- llvm/Support/Compression.h ---Compression----------------*- C++ -*-===//
  2. //
  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
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file contains basic functions for compression/uncompression.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_SUPPORT_COMPRESSION_H
  13. #define LLVM_SUPPORT_COMPRESSION_H
  14. #include "llvm/Support/DataTypes.h"
  15. namespace llvm {
  16. template <typename T> class SmallVectorImpl;
  17. class Error;
  18. class StringRef;
  19. namespace zlib {
  20. static constexpr int NoCompression = 0;
  21. static constexpr int BestSpeedCompression = 1;
  22. static constexpr int DefaultCompression = 6;
  23. static constexpr int BestSizeCompression = 9;
  24. bool isAvailable();
  25. Error compress(StringRef InputBuffer, SmallVectorImpl<char> &CompressedBuffer,
  26. int Level = DefaultCompression);
  27. Error uncompress(StringRef InputBuffer, char *UncompressedBuffer,
  28. size_t &UncompressedSize);
  29. Error uncompress(StringRef InputBuffer,
  30. SmallVectorImpl<char> &UncompressedBuffer,
  31. size_t UncompressedSize);
  32. uint32_t crc32(StringRef Buffer);
  33. } // End of namespace zlib
  34. } // End of namespace llvm
  35. #endif