From: Yann Collet Date: Wed, 29 Dec 2021 20:03:36 +0000 (-0800) Subject: change the offset|repcode sumtype format to match offBase X-Git-Tag: v1.5.4^2~262^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f92ec5ea54d64207f5ffd30b5c746367a6e75dc4;p=thirdparty%2Fzstd.git change the offset|repcode sumtype format to match offBase directly at ZSTD_storeSeq() interface. In the process, remove ZSTD_REP_MOVE. This makes it possible, in future commits, to update and effectively simplify the naming scheme to properly label the updated processing pipeline : offset | repcode => offBase => offCode + offBits --- diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index c406e794b..f71791ec0 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -577,18 +577,17 @@ ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const iend, BYTE con while (ip < iend) *op++ = *ip++; } -#define ZSTD_REP_MOVE (ZSTD_REP_NUM-1) #define STORE_REPCODE_1 STORE_REPCODE(1) #define STORE_REPCODE_2 STORE_REPCODE(2) #define STORE_REPCODE_3 STORE_REPCODE(3) -#define STORE_REPCODE(r) (assert((r)>=1), assert((r)<=3), (r)-1) -#define STORE_OFFSET(o) (assert((o)>0), o + ZSTD_REP_MOVE) -#define STORED_IS_OFFSET(o) ((o) > ZSTD_REP_MOVE) -#define STORED_IS_REPCODE(o) ((o) <= ZSTD_REP_MOVE) -#define STORED_OFFSET(o) (assert(STORED_IS_OFFSET(o)), (o)-ZSTD_REP_MOVE) -#define STORED_REPCODE(o) (assert(STORED_IS_REPCODE(o)), (o)+1) /* returns ID 1,2,3 */ -#define STORED_TO_OFFBASE(o) ((o)+1) -#define OFFBASE_TO_STORED(o) ((o)-1) +#define STORE_REPCODE(r) (assert((r)>=1), assert((r)<=ZSTD_REP_NUM), (r)) /* accepts IDs 1,2,3 */ +#define STORE_OFFSET(o) (assert((o)>0), o + ZSTD_REP_NUM) +#define STORED_IS_OFFSET(o) ((o) > ZSTD_REP_NUM) +#define STORED_IS_REPCODE(o) ( 1 <= (o) && (o) <= ZSTD_REP_NUM) +#define STORED_OFFSET(o) (assert(STORED_IS_OFFSET(o)), (o) - ZSTD_REP_NUM) +#define STORED_REPCODE(o) (assert(STORED_IS_REPCODE(o)), (o)) /* returns ID 1,2,3 */ +#define STORED_TO_OFFBASE(o) (o) +#define OFFBASE_TO_STORED(o) (o) /*! ZSTD_storeSeq() : * Store a sequence (litlen, litPtr, offCode and matchLength) into seqStore_t.