/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under both the BSD-style license (found in the * LICENSE file in the root directory of this source tree) and the GPLv2 (found * in the COPYING file in the root directory of this source tree). * You may select, at your option, one of the above-listed licenses. */ /* The implementation lives in rust/src/zstd_compress_superblock.rs. Keep the * context extraction here: ZSTD_CCtx is intentionally opaque to Rust, while * the small sequence and entropy leaf layouts are asserted in both sources. */ #include "zstd_compress_superblock.h" #include "zstd_compress_internal.h" typedef char ZSTD_rust_superblock_seqdef_layout[(sizeof(SeqDef) == 8) ? 1 : -1]; typedef char ZSTD_rust_superblock_fse_layout[(sizeof(ZSTD_fseCTables_t) == 3552) ? 1 : -1]; typedef char ZSTD_rust_superblock_entropy_offset[ (offsetof(ZSTD_compressedBlockState_t, entropy) == 0) ? 1 : -1]; typedef char ZSTD_rust_superblock_rep_offset[ (offsetof(ZSTD_compressedBlockState_t, rep) == sizeof(ZSTD_entropyCTables_t)) ? 1 : -1]; typedef char ZSTD_rust_superblock_seqstore_long_length_pos[ (offsetof(SeqStore_t, longLengthPos) == 9 * sizeof(size_t) + 4) ? 1 : -1]; typedef char ZSTD_rust_superblock_seqstore_layout[ (sizeof(SeqStore_t) == 9 * sizeof(size_t) + 8) ? 1 : -1]; size_t ZSTD_rust_compressSuperBlock( const SeqStore_t* seqStore, const ZSTD_compressedBlockState_t* prevCBlock, ZSTD_compressedBlockState_t* nextCBlock, int strategy, int disableLiteralCompression, void* workspace, size_t wkspSize, int bmi2, U32 windowLog, size_t targetCBlockSize, void* dst, size_t dstCapacity, const void* src, size_t srcSize, U32 lastBlock); size_t ZSTD_compressSuperBlock(ZSTD_CCtx* zc, void* dst, size_t dstCapacity, const void* src, size_t srcSize, unsigned lastBlock) { return ZSTD_rust_compressSuperBlock( &zc->seqStore, zc->blockState.prevCBlock, zc->blockState.nextCBlock, (int)zc->appliedParams.cParams.strategy, ZSTD_literalsCompressionIsDisabled(&zc->appliedParams), zc->tmpWorkspace, zc->tmpWkspSize, zc->bmi2, zc->appliedParams.cParams.windowLog, zc->appliedParams.targetCBlockSize, dst, dstCapacity, src, srcSize, lastBlock); }