* lib/zstd/compress/zstd_opt.c:959:61: warning: Same expression on both sides of '-' because 'ip' and 'istart' represent the same value. [knownConditionTrueFalse]
@ 2021-12-30 11:59 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-12-30 11:59 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 24990 bytes --]
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Nick Terrell <terrelln@fb.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: eec4df26e24e978e49ccf9bcf49ca0f2ccdaeffe
commit: e0c1b49f5b674cca7b10549c53b3791d0bbc90a8 lib: zstd: Upgrade to latest upstream zstd version 1.4.10
date: 7 weeks ago
:::::: branch date: 17 hours ago
:::::: commit date: 7 weeks ago
compiler: h8300-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> net/wireless/util.c:1202:6: warning: Same expression on both sides of '-'. [duplicateExpression]
[6 - 6] = 26950, /* MCS 9.1 : 2695.0 mbps */
^
>> net/wireless/nl80211.c:73:6: warning: Local variable wdev_id shadows outer function [shadowFunction]
u64 wdev_id = 0;
^
net/wireless/nl80211.h:19:19: note: Shadowed declaration
static inline u64 wdev_id(struct wireless_dev *wdev)
^
net/wireless/nl80211.c:73:6: note: Shadow variable
u64 wdev_id = 0;
^
net/wireless/nl80211.c:157:7: warning: Local variable wdev_id shadows outer function [shadowFunction]
u64 wdev_id = nla_get_u64(attrs[NL80211_ATTR_WDEV]);
^
net/wireless/nl80211.h:19:19: note: Shadowed declaration
static inline u64 wdev_id(struct wireless_dev *wdev)
^
net/wireless/nl80211.c:157:7: note: Shadow variable
u64 wdev_id = nla_get_u64(attrs[NL80211_ATTR_WDEV]);
^
>> lib/zstd/compress/zstd_opt.c:959:61: warning: Same expression on both sides of '-' because 'ip' and 'istart' represent the same value. [knownConditionTrueFalse]
ZSTD_opt_getNextMatchAndUpdateSeqStore(&optLdm, (U32)(ip-istart), (U32)(iend-ip));
^
lib/zstd/compress/zstd_opt.c:940:22: note: 'ip' is assigned value 'istart' here.
const BYTE* ip = istart;
^
lib/zstd/compress/zstd_opt.c:959:61: note: Same expression on both sides of '-' because 'ip' and 'istart' represent the same value.
ZSTD_opt_getNextMatchAndUpdateSeqStore(&optLdm, (U32)(ip-istart), (U32)(iend-ip));
^
>> net/bluetooth/bnep/core.c:111:2: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
data++;
^
net/bluetooth/bnep/core.c:157:2: warning: Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? [uselessAssignmentPtrArg]
data += 2;
^
vim +959 lib/zstd/compress/zstd_opt.c
e0c1b49f5b674c Nick Terrell 2020-09-11 929
e0c1b49f5b674c Nick Terrell 2020-09-11 930 FORCE_INLINE_TEMPLATE size_t
e0c1b49f5b674c Nick Terrell 2020-09-11 931 ZSTD_compressBlock_opt_generic(ZSTD_matchState_t* ms,
e0c1b49f5b674c Nick Terrell 2020-09-11 932 seqStore_t* seqStore,
e0c1b49f5b674c Nick Terrell 2020-09-11 933 U32 rep[ZSTD_REP_NUM],
e0c1b49f5b674c Nick Terrell 2020-09-11 934 const void* src, size_t srcSize,
e0c1b49f5b674c Nick Terrell 2020-09-11 935 const int optLevel,
e0c1b49f5b674c Nick Terrell 2020-09-11 936 const ZSTD_dictMode_e dictMode)
e0c1b49f5b674c Nick Terrell 2020-09-11 937 {
e0c1b49f5b674c Nick Terrell 2020-09-11 938 optState_t* const optStatePtr = &ms->opt;
e0c1b49f5b674c Nick Terrell 2020-09-11 939 const BYTE* const istart = (const BYTE*)src;
e0c1b49f5b674c Nick Terrell 2020-09-11 940 const BYTE* ip = istart;
e0c1b49f5b674c Nick Terrell 2020-09-11 941 const BYTE* anchor = istart;
e0c1b49f5b674c Nick Terrell 2020-09-11 942 const BYTE* const iend = istart + srcSize;
e0c1b49f5b674c Nick Terrell 2020-09-11 943 const BYTE* const ilimit = iend - 8;
e0c1b49f5b674c Nick Terrell 2020-09-11 944 const BYTE* const base = ms->window.base;
e0c1b49f5b674c Nick Terrell 2020-09-11 945 const BYTE* const prefixStart = base + ms->window.dictLimit;
e0c1b49f5b674c Nick Terrell 2020-09-11 946 const ZSTD_compressionParameters* const cParams = &ms->cParams;
e0c1b49f5b674c Nick Terrell 2020-09-11 947
e0c1b49f5b674c Nick Terrell 2020-09-11 948 U32 const sufficient_len = MIN(cParams->targetLength, ZSTD_OPT_NUM -1);
e0c1b49f5b674c Nick Terrell 2020-09-11 949 U32 const minMatch = (cParams->minMatch == 3) ? 3 : 4;
e0c1b49f5b674c Nick Terrell 2020-09-11 950 U32 nextToUpdate3 = ms->nextToUpdate;
e0c1b49f5b674c Nick Terrell 2020-09-11 951
e0c1b49f5b674c Nick Terrell 2020-09-11 952 ZSTD_optimal_t* const opt = optStatePtr->priceTable;
e0c1b49f5b674c Nick Terrell 2020-09-11 953 ZSTD_match_t* const matches = optStatePtr->matchTable;
e0c1b49f5b674c Nick Terrell 2020-09-11 954 ZSTD_optimal_t lastSequence;
e0c1b49f5b674c Nick Terrell 2020-09-11 955 ZSTD_optLdm_t optLdm;
e0c1b49f5b674c Nick Terrell 2020-09-11 956
e0c1b49f5b674c Nick Terrell 2020-09-11 957 optLdm.seqStore = ms->ldmSeqStore ? *ms->ldmSeqStore : kNullRawSeqStore;
e0c1b49f5b674c Nick Terrell 2020-09-11 958 optLdm.endPosInBlock = optLdm.startPosInBlock = optLdm.offset = 0;
e0c1b49f5b674c Nick Terrell 2020-09-11 @959 ZSTD_opt_getNextMatchAndUpdateSeqStore(&optLdm, (U32)(ip-istart), (U32)(iend-ip));
e0c1b49f5b674c Nick Terrell 2020-09-11 960
e0c1b49f5b674c Nick Terrell 2020-09-11 961 /* init */
e0c1b49f5b674c Nick Terrell 2020-09-11 962 DEBUGLOG(5, "ZSTD_compressBlock_opt_generic: current=%u, prefix=%u, nextToUpdate=%u",
e0c1b49f5b674c Nick Terrell 2020-09-11 963 (U32)(ip - base), ms->window.dictLimit, ms->nextToUpdate);
e0c1b49f5b674c Nick Terrell 2020-09-11 964 assert(optLevel <= 2);
e0c1b49f5b674c Nick Terrell 2020-09-11 965 ZSTD_rescaleFreqs(optStatePtr, (const BYTE*)src, srcSize, optLevel);
e0c1b49f5b674c Nick Terrell 2020-09-11 966 ip += (ip==prefixStart);
e0c1b49f5b674c Nick Terrell 2020-09-11 967
e0c1b49f5b674c Nick Terrell 2020-09-11 968 /* Match Loop */
e0c1b49f5b674c Nick Terrell 2020-09-11 969 while (ip < ilimit) {
e0c1b49f5b674c Nick Terrell 2020-09-11 970 U32 cur, last_pos = 0;
e0c1b49f5b674c Nick Terrell 2020-09-11 971
e0c1b49f5b674c Nick Terrell 2020-09-11 972 /* find first match */
e0c1b49f5b674c Nick Terrell 2020-09-11 973 { U32 const litlen = (U32)(ip - anchor);
e0c1b49f5b674c Nick Terrell 2020-09-11 974 U32 const ll0 = !litlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 975 U32 nbMatches = ZSTD_BtGetAllMatches(matches, ms, &nextToUpdate3, ip, iend, dictMode, rep, ll0, minMatch);
e0c1b49f5b674c Nick Terrell 2020-09-11 976 ZSTD_optLdm_processMatchCandidate(&optLdm, matches, &nbMatches,
e0c1b49f5b674c Nick Terrell 2020-09-11 977 (U32)(ip-istart), (U32)(iend - ip));
e0c1b49f5b674c Nick Terrell 2020-09-11 978 if (!nbMatches) { ip++; continue; }
e0c1b49f5b674c Nick Terrell 2020-09-11 979
e0c1b49f5b674c Nick Terrell 2020-09-11 980 /* initialize opt[0] */
e0c1b49f5b674c Nick Terrell 2020-09-11 981 { U32 i ; for (i=0; i<ZSTD_REP_NUM; i++) opt[0].rep[i] = rep[i]; }
e0c1b49f5b674c Nick Terrell 2020-09-11 982 opt[0].mlen = 0; /* means is_a_literal */
e0c1b49f5b674c Nick Terrell 2020-09-11 983 opt[0].litlen = litlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 984 /* We don't need to include the actual price of the literals because
e0c1b49f5b674c Nick Terrell 2020-09-11 985 * it is static for the duration of the forward pass, and is included
e0c1b49f5b674c Nick Terrell 2020-09-11 986 * in every price. We include the literal length to avoid negative
e0c1b49f5b674c Nick Terrell 2020-09-11 987 * prices when we subtract the previous literal length.
e0c1b49f5b674c Nick Terrell 2020-09-11 988 */
e0c1b49f5b674c Nick Terrell 2020-09-11 989 opt[0].price = ZSTD_litLengthPrice(litlen, optStatePtr, optLevel);
e0c1b49f5b674c Nick Terrell 2020-09-11 990
e0c1b49f5b674c Nick Terrell 2020-09-11 991 /* large match -> immediate encoding */
e0c1b49f5b674c Nick Terrell 2020-09-11 992 { U32 const maxML = matches[nbMatches-1].len;
e0c1b49f5b674c Nick Terrell 2020-09-11 993 U32 const maxOffset = matches[nbMatches-1].off;
e0c1b49f5b674c Nick Terrell 2020-09-11 994 DEBUGLOG(6, "found %u matches of maxLength=%u and maxOffCode=%u at cPos=%u => start new series",
e0c1b49f5b674c Nick Terrell 2020-09-11 995 nbMatches, maxML, maxOffset, (U32)(ip-prefixStart));
e0c1b49f5b674c Nick Terrell 2020-09-11 996
e0c1b49f5b674c Nick Terrell 2020-09-11 997 if (maxML > sufficient_len) {
e0c1b49f5b674c Nick Terrell 2020-09-11 998 lastSequence.litlen = litlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 999 lastSequence.mlen = maxML;
e0c1b49f5b674c Nick Terrell 2020-09-11 1000 lastSequence.off = maxOffset;
e0c1b49f5b674c Nick Terrell 2020-09-11 1001 DEBUGLOG(6, "large match (%u>%u), immediate encoding",
e0c1b49f5b674c Nick Terrell 2020-09-11 1002 maxML, sufficient_len);
e0c1b49f5b674c Nick Terrell 2020-09-11 1003 cur = 0;
e0c1b49f5b674c Nick Terrell 2020-09-11 1004 last_pos = ZSTD_totalLen(lastSequence);
e0c1b49f5b674c Nick Terrell 2020-09-11 1005 goto _shortestPath;
e0c1b49f5b674c Nick Terrell 2020-09-11 1006 } }
e0c1b49f5b674c Nick Terrell 2020-09-11 1007
e0c1b49f5b674c Nick Terrell 2020-09-11 1008 /* set prices for first matches starting position == 0 */
e0c1b49f5b674c Nick Terrell 2020-09-11 1009 { U32 const literalsPrice = opt[0].price + ZSTD_litLengthPrice(0, optStatePtr, optLevel);
e0c1b49f5b674c Nick Terrell 2020-09-11 1010 U32 pos;
e0c1b49f5b674c Nick Terrell 2020-09-11 1011 U32 matchNb;
e0c1b49f5b674c Nick Terrell 2020-09-11 1012 for (pos = 1; pos < minMatch; pos++) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1013 opt[pos].price = ZSTD_MAX_PRICE; /* mlen, litlen and price will be fixed during forward scanning */
e0c1b49f5b674c Nick Terrell 2020-09-11 1014 }
e0c1b49f5b674c Nick Terrell 2020-09-11 1015 for (matchNb = 0; matchNb < nbMatches; matchNb++) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1016 U32 const offset = matches[matchNb].off;
e0c1b49f5b674c Nick Terrell 2020-09-11 1017 U32 const end = matches[matchNb].len;
e0c1b49f5b674c Nick Terrell 2020-09-11 1018 for ( ; pos <= end ; pos++ ) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1019 U32 const matchPrice = ZSTD_getMatchPrice(offset, pos, optStatePtr, optLevel);
e0c1b49f5b674c Nick Terrell 2020-09-11 1020 U32 const sequencePrice = literalsPrice + matchPrice;
e0c1b49f5b674c Nick Terrell 2020-09-11 1021 DEBUGLOG(7, "rPos:%u => set initial price : %.2f",
e0c1b49f5b674c Nick Terrell 2020-09-11 1022 pos, ZSTD_fCost(sequencePrice));
e0c1b49f5b674c Nick Terrell 2020-09-11 1023 opt[pos].mlen = pos;
e0c1b49f5b674c Nick Terrell 2020-09-11 1024 opt[pos].off = offset;
e0c1b49f5b674c Nick Terrell 2020-09-11 1025 opt[pos].litlen = litlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 1026 opt[pos].price = sequencePrice;
e0c1b49f5b674c Nick Terrell 2020-09-11 1027 } }
e0c1b49f5b674c Nick Terrell 2020-09-11 1028 last_pos = pos-1;
e0c1b49f5b674c Nick Terrell 2020-09-11 1029 }
e0c1b49f5b674c Nick Terrell 2020-09-11 1030 }
e0c1b49f5b674c Nick Terrell 2020-09-11 1031
e0c1b49f5b674c Nick Terrell 2020-09-11 1032 /* check further positions */
e0c1b49f5b674c Nick Terrell 2020-09-11 1033 for (cur = 1; cur <= last_pos; cur++) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1034 const BYTE* const inr = ip + cur;
e0c1b49f5b674c Nick Terrell 2020-09-11 1035 assert(cur < ZSTD_OPT_NUM);
e0c1b49f5b674c Nick Terrell 2020-09-11 1036 DEBUGLOG(7, "cPos:%zi==rPos:%u", inr-istart, cur)
e0c1b49f5b674c Nick Terrell 2020-09-11 1037
e0c1b49f5b674c Nick Terrell 2020-09-11 1038 /* Fix current position with one literal if cheaper */
e0c1b49f5b674c Nick Terrell 2020-09-11 1039 { U32 const litlen = (opt[cur-1].mlen == 0) ? opt[cur-1].litlen + 1 : 1;
e0c1b49f5b674c Nick Terrell 2020-09-11 1040 int const price = opt[cur-1].price
e0c1b49f5b674c Nick Terrell 2020-09-11 1041 + ZSTD_rawLiteralsCost(ip+cur-1, 1, optStatePtr, optLevel)
e0c1b49f5b674c Nick Terrell 2020-09-11 1042 + ZSTD_litLengthPrice(litlen, optStatePtr, optLevel)
e0c1b49f5b674c Nick Terrell 2020-09-11 1043 - ZSTD_litLengthPrice(litlen-1, optStatePtr, optLevel);
e0c1b49f5b674c Nick Terrell 2020-09-11 1044 assert(price < 1000000000); /* overflow check */
e0c1b49f5b674c Nick Terrell 2020-09-11 1045 if (price <= opt[cur].price) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1046 DEBUGLOG(7, "cPos:%zi==rPos:%u : better price (%.2f<=%.2f) using literal (ll==%u) (hist:%u,%u,%u)",
e0c1b49f5b674c Nick Terrell 2020-09-11 1047 inr-istart, cur, ZSTD_fCost(price), ZSTD_fCost(opt[cur].price), litlen,
e0c1b49f5b674c Nick Terrell 2020-09-11 1048 opt[cur-1].rep[0], opt[cur-1].rep[1], opt[cur-1].rep[2]);
e0c1b49f5b674c Nick Terrell 2020-09-11 1049 opt[cur].mlen = 0;
e0c1b49f5b674c Nick Terrell 2020-09-11 1050 opt[cur].off = 0;
e0c1b49f5b674c Nick Terrell 2020-09-11 1051 opt[cur].litlen = litlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 1052 opt[cur].price = price;
e0c1b49f5b674c Nick Terrell 2020-09-11 1053 } else {
e0c1b49f5b674c Nick Terrell 2020-09-11 1054 DEBUGLOG(7, "cPos:%zi==rPos:%u : literal would cost more (%.2f>%.2f) (hist:%u,%u,%u)",
e0c1b49f5b674c Nick Terrell 2020-09-11 1055 inr-istart, cur, ZSTD_fCost(price), ZSTD_fCost(opt[cur].price),
e0c1b49f5b674c Nick Terrell 2020-09-11 1056 opt[cur].rep[0], opt[cur].rep[1], opt[cur].rep[2]);
e0c1b49f5b674c Nick Terrell 2020-09-11 1057 }
e0c1b49f5b674c Nick Terrell 2020-09-11 1058 }
e0c1b49f5b674c Nick Terrell 2020-09-11 1059
e0c1b49f5b674c Nick Terrell 2020-09-11 1060 /* Set the repcodes of the current position. We must do it here
e0c1b49f5b674c Nick Terrell 2020-09-11 1061 * because we rely on the repcodes of the 2nd to last sequence being
e0c1b49f5b674c Nick Terrell 2020-09-11 1062 * correct to set the next chunks repcodes during the backward
e0c1b49f5b674c Nick Terrell 2020-09-11 1063 * traversal.
e0c1b49f5b674c Nick Terrell 2020-09-11 1064 */
e0c1b49f5b674c Nick Terrell 2020-09-11 1065 ZSTD_STATIC_ASSERT(sizeof(opt[cur].rep) == sizeof(repcodes_t));
e0c1b49f5b674c Nick Terrell 2020-09-11 1066 assert(cur >= opt[cur].mlen);
e0c1b49f5b674c Nick Terrell 2020-09-11 1067 if (opt[cur].mlen != 0) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1068 U32 const prev = cur - opt[cur].mlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 1069 repcodes_t newReps = ZSTD_updateRep(opt[prev].rep, opt[cur].off, opt[cur].litlen==0);
e0c1b49f5b674c Nick Terrell 2020-09-11 1070 ZSTD_memcpy(opt[cur].rep, &newReps, sizeof(repcodes_t));
e0c1b49f5b674c Nick Terrell 2020-09-11 1071 } else {
e0c1b49f5b674c Nick Terrell 2020-09-11 1072 ZSTD_memcpy(opt[cur].rep, opt[cur - 1].rep, sizeof(repcodes_t));
e0c1b49f5b674c Nick Terrell 2020-09-11 1073 }
e0c1b49f5b674c Nick Terrell 2020-09-11 1074
e0c1b49f5b674c Nick Terrell 2020-09-11 1075 /* last match must start at a minimum distance of 8 from oend */
e0c1b49f5b674c Nick Terrell 2020-09-11 1076 if (inr > ilimit) continue;
e0c1b49f5b674c Nick Terrell 2020-09-11 1077
e0c1b49f5b674c Nick Terrell 2020-09-11 1078 if (cur == last_pos) break;
e0c1b49f5b674c Nick Terrell 2020-09-11 1079
e0c1b49f5b674c Nick Terrell 2020-09-11 1080 if ( (optLevel==0) /*static_test*/
e0c1b49f5b674c Nick Terrell 2020-09-11 1081 && (opt[cur+1].price <= opt[cur].price + (BITCOST_MULTIPLIER/2)) ) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1082 DEBUGLOG(7, "move to next rPos:%u : price is <=", cur+1);
e0c1b49f5b674c Nick Terrell 2020-09-11 1083 continue; /* skip unpromising positions; about ~+6% speed, -0.01 ratio */
e0c1b49f5b674c Nick Terrell 2020-09-11 1084 }
e0c1b49f5b674c Nick Terrell 2020-09-11 1085
e0c1b49f5b674c Nick Terrell 2020-09-11 1086 { U32 const ll0 = (opt[cur].mlen != 0);
e0c1b49f5b674c Nick Terrell 2020-09-11 1087 U32 const litlen = (opt[cur].mlen == 0) ? opt[cur].litlen : 0;
e0c1b49f5b674c Nick Terrell 2020-09-11 1088 U32 const previousPrice = opt[cur].price;
e0c1b49f5b674c Nick Terrell 2020-09-11 1089 U32 const basePrice = previousPrice + ZSTD_litLengthPrice(0, optStatePtr, optLevel);
e0c1b49f5b674c Nick Terrell 2020-09-11 1090 U32 nbMatches = ZSTD_BtGetAllMatches(matches, ms, &nextToUpdate3, inr, iend, dictMode, opt[cur].rep, ll0, minMatch);
e0c1b49f5b674c Nick Terrell 2020-09-11 1091 U32 matchNb;
e0c1b49f5b674c Nick Terrell 2020-09-11 1092
e0c1b49f5b674c Nick Terrell 2020-09-11 1093 ZSTD_optLdm_processMatchCandidate(&optLdm, matches, &nbMatches,
e0c1b49f5b674c Nick Terrell 2020-09-11 1094 (U32)(inr-istart), (U32)(iend-inr));
e0c1b49f5b674c Nick Terrell 2020-09-11 1095
e0c1b49f5b674c Nick Terrell 2020-09-11 1096 if (!nbMatches) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1097 DEBUGLOG(7, "rPos:%u : no match found", cur);
e0c1b49f5b674c Nick Terrell 2020-09-11 1098 continue;
e0c1b49f5b674c Nick Terrell 2020-09-11 1099 }
e0c1b49f5b674c Nick Terrell 2020-09-11 1100
e0c1b49f5b674c Nick Terrell 2020-09-11 1101 { U32 const maxML = matches[nbMatches-1].len;
e0c1b49f5b674c Nick Terrell 2020-09-11 1102 DEBUGLOG(7, "cPos:%zi==rPos:%u, found %u matches, of maxLength=%u",
e0c1b49f5b674c Nick Terrell 2020-09-11 1103 inr-istart, cur, nbMatches, maxML);
e0c1b49f5b674c Nick Terrell 2020-09-11 1104
e0c1b49f5b674c Nick Terrell 2020-09-11 1105 if ( (maxML > sufficient_len)
e0c1b49f5b674c Nick Terrell 2020-09-11 1106 || (cur + maxML >= ZSTD_OPT_NUM) ) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1107 lastSequence.mlen = maxML;
e0c1b49f5b674c Nick Terrell 2020-09-11 1108 lastSequence.off = matches[nbMatches-1].off;
e0c1b49f5b674c Nick Terrell 2020-09-11 1109 lastSequence.litlen = litlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 1110 cur -= (opt[cur].mlen==0) ? opt[cur].litlen : 0; /* last sequence is actually only literals, fix cur to last match - note : may underflow, in which case, it's first sequence, and it's okay */
e0c1b49f5b674c Nick Terrell 2020-09-11 1111 last_pos = cur + ZSTD_totalLen(lastSequence);
e0c1b49f5b674c Nick Terrell 2020-09-11 1112 if (cur > ZSTD_OPT_NUM) cur = 0; /* underflow => first match */
e0c1b49f5b674c Nick Terrell 2020-09-11 1113 goto _shortestPath;
e0c1b49f5b674c Nick Terrell 2020-09-11 1114 } }
e0c1b49f5b674c Nick Terrell 2020-09-11 1115
e0c1b49f5b674c Nick Terrell 2020-09-11 1116 /* set prices using matches found at position == cur */
e0c1b49f5b674c Nick Terrell 2020-09-11 1117 for (matchNb = 0; matchNb < nbMatches; matchNb++) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1118 U32 const offset = matches[matchNb].off;
e0c1b49f5b674c Nick Terrell 2020-09-11 1119 U32 const lastML = matches[matchNb].len;
e0c1b49f5b674c Nick Terrell 2020-09-11 1120 U32 const startML = (matchNb>0) ? matches[matchNb-1].len+1 : minMatch;
e0c1b49f5b674c Nick Terrell 2020-09-11 1121 U32 mlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 1122
e0c1b49f5b674c Nick Terrell 2020-09-11 1123 DEBUGLOG(7, "testing match %u => offCode=%4u, mlen=%2u, llen=%2u",
e0c1b49f5b674c Nick Terrell 2020-09-11 1124 matchNb, matches[matchNb].off, lastML, litlen);
e0c1b49f5b674c Nick Terrell 2020-09-11 1125
e0c1b49f5b674c Nick Terrell 2020-09-11 1126 for (mlen = lastML; mlen >= startML; mlen--) { /* scan downward */
e0c1b49f5b674c Nick Terrell 2020-09-11 1127 U32 const pos = cur + mlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 1128 int const price = basePrice + ZSTD_getMatchPrice(offset, mlen, optStatePtr, optLevel);
e0c1b49f5b674c Nick Terrell 2020-09-11 1129
e0c1b49f5b674c Nick Terrell 2020-09-11 1130 if ((pos > last_pos) || (price < opt[pos].price)) {
e0c1b49f5b674c Nick Terrell 2020-09-11 1131 DEBUGLOG(7, "rPos:%u (ml=%2u) => new better price (%.2f<%.2f)",
e0c1b49f5b674c Nick Terrell 2020-09-11 1132 pos, mlen, ZSTD_fCost(price), ZSTD_fCost(opt[pos].price));
e0c1b49f5b674c Nick Terrell 2020-09-11 1133 while (last_pos < pos) { opt[last_pos+1].price = ZSTD_MAX_PRICE; last_pos++; } /* fill empty positions */
e0c1b49f5b674c Nick Terrell 2020-09-11 1134 opt[pos].mlen = mlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 1135 opt[pos].off = offset;
e0c1b49f5b674c Nick Terrell 2020-09-11 1136 opt[pos].litlen = litlen;
e0c1b49f5b674c Nick Terrell 2020-09-11 1137 opt[pos].price = price;
e0c1b49f5b674c Nick Terrell 2020-09-11 1138 } else {
e0c1b49f5b674c Nick Terrell 2020-09-11 1139 DEBUGLOG(7, "rPos:%u (ml=%2u) => new price is worse (%.2f>=%.2f)",
e0c1b49f5b674c Nick Terrell 2020-09-11 1140 pos, mlen, ZSTD_fCost(price), ZSTD_fCost(opt[pos].price));
e0c1b49f5b674c Nick Terrell 2020-09-11 1141 if (optLevel==0) break; /* early update abort; gets ~+10% speed for about -0.01 ratio loss */
e0c1b49f5b674c Nick Terrell 2020-09-11 1142 }
e0c1b49f5b674c Nick Terrell 2020-09-11 1143 } } }
e0c1b49f5b674c Nick Terrell 2020-09-11 1144 } /* for (cur = 1; cur <= last_pos; cur++) */
e0c1b49f5b674c Nick Terrell 2020-09-11 1145
e0c1b49f5b674c Nick Terrell 2020-09-11 1146 lastSequence = opt[last_pos];
e0c1b49f5b674c Nick Terrell 2020-09-11 1147 cur = last_pos > ZSTD_totalLen(lastSequence) ? last_pos - ZSTD_totalLen(lastSequence) : 0; /* single sequence, and it starts before `ip` */
e0c1b49f5b674c Nick Terrell 2020-09-11 1148 assert(cur < ZSTD_OPT_NUM); /* control overflow*/
e0c1b49f5b674c Nick Terrell 2020-09-11 1149
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-30 11:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-30 11:59 lib/zstd/compress/zstd_opt.c:959:61: warning: Same expression on both sides of '-' because 'ip' and 'istart' represent the same value. [knownConditionTrueFalse] kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.