#ifndef RT_COMPRESSION_H
#define RT_COMPRESSION_H

#include "runtime.h"

#ifdef __cplusplus
extern "C" {
#endif

/* Returns the worst-case size of the compression result of a buffer with the given uncompressed
 * size. */
RT_DLLEXPORT size_t rtGetCompressionBound(size_t uncompressed_size);

/* Compresses a buffer.
 *
 * Returns the number of bytes written to the output buffer, or 0 if compression failed
 * due to insufficient capacity.
 */
RT_DLLEXPORT size_t rtCompressData(const void *in,
                                   size_t uncompressed_size,
                                   void *out,
                                   size_t out_capacity);

/* Decompresses a buffer.
 *
 * Returns the number of bytes written to the output buffer, or 0 if decompression failed
 * due to insufficient capacity.
 */
RT_DLLEXPORT size_t rtDecompressData(const void *in,
                                     size_t compressed_size,
                                     void *out,
                                     size_t out_capacity);

#ifdef __cplusplus
}
#endif

#endif
