Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zstd
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CodeLinaro
yocto-mirrors
zstd
Commits
e909fa62
Commit
e909fa62
authored
3 years ago
by
Yann Collet
Browse files
Options
Downloads
Patches
Plain Diff
abstracted storeSeq() sumtype numeric representation from zstd_opt.c
parent
681c81f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/compress/zstd_compress_internal.h
+2
-1
2 additions, 1 deletion
lib/compress/zstd_compress_internal.h
lib/compress/zstd_opt.c
+7
-5
7 additions, 5 deletions
lib/compress/zstd_opt.c
with
9 additions
and
6 deletions
lib/compress/zstd_compress_internal.h
+
2
−
1
View file @
e909fa62
...
@@ -586,6 +586,7 @@ ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const iend, BYTE con
...
@@ -586,6 +586,7 @@ ZSTD_safecopyLiterals(BYTE* op, BYTE const* ip, BYTE const* const iend, BYTE con
#define STORED_IS_REPCODE(o) ((o) < ZSTD_REP_NUM)
#define STORED_IS_REPCODE(o) ((o) < ZSTD_REP_NUM)
#define STORED_OFFSET(o) (assert(STORED_IS_OFFSET(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_REPCODE(o) (assert(STORED_IS_REPCODE(o)), (o)+1)
/* returns ID 1,2,3 */
#define STORED_TO_OFFBASE(o) ((o)+1)
/*! ZSTD_storeSeq() :
/*! ZSTD_storeSeq() :
* Store a sequence (litlen, litPtr, offCode and matchLength) into seqStore_t.
* Store a sequence (litlen, litPtr, offCode and matchLength) into seqStore_t.
...
@@ -639,7 +640,7 @@ ZSTD_storeSeq(seqStore_t* seqStorePtr,
...
@@ -639,7 +640,7 @@ ZSTD_storeSeq(seqStore_t* seqStorePtr,
seqStorePtr
->
sequences
[
0
].
litLength
=
(
U16
)
litLength
;
seqStorePtr
->
sequences
[
0
].
litLength
=
(
U16
)
litLength
;
/* match offset */
/* match offset */
seqStorePtr
->
sequences
[
0
].
offBase
=
offBase_minus1
+
1
;
seqStorePtr
->
sequences
[
0
].
offBase
=
STORED_TO_OFFBASE
(
offBase_minus1
)
;
/* match Length */
/* match Length */
assert
(
matchLength
>=
MINMATCH
);
assert
(
matchLength
>=
MINMATCH
);
...
...
This diff is collapsed.
Click to expand it.
lib/compress/zstd_opt.c
+
7
−
5
View file @
e909fa62
...
@@ -204,7 +204,8 @@ ZSTD_rescaleFreqs(optState_t* const optPtr,
...
@@ -204,7 +204,8 @@ ZSTD_rescaleFreqs(optState_t* const optPtr,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
1
,
1
,
1
,
1
};
};
ZSTD_memcpy
(
optPtr
->
litLengthFreq
,
baseLLfreqs
,
sizeof
(
baseLLfreqs
));
optPtr
->
litLengthSum
=
sum_u32
(
baseLLfreqs
,
MaxLL
+
1
);
ZSTD_memcpy
(
optPtr
->
litLengthFreq
,
baseLLfreqs
,
sizeof
(
baseLLfreqs
));
optPtr
->
litLengthSum
=
sum_u32
(
baseLLfreqs
,
MaxLL
+
1
);
}
}
{
unsigned
ml
;
{
unsigned
ml
;
...
@@ -219,7 +220,8 @@ ZSTD_rescaleFreqs(optState_t* const optPtr,
...
@@ -219,7 +220,8 @@ ZSTD_rescaleFreqs(optState_t* const optPtr,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
};
};
ZSTD_memcpy
(
optPtr
->
offCodeFreq
,
baseOFCfreqs
,
sizeof
(
baseOFCfreqs
));
optPtr
->
offCodeSum
=
sum_u32
(
baseOFCfreqs
,
MaxOff
+
1
);
ZSTD_memcpy
(
optPtr
->
offCodeFreq
,
baseOFCfreqs
,
sizeof
(
baseOFCfreqs
));
optPtr
->
offCodeSum
=
sum_u32
(
baseOFCfreqs
,
MaxOff
+
1
);
}
}
...
@@ -290,7 +292,7 @@ ZSTD_getMatchPrice(U32 const offcode,
...
@@ -290,7 +292,7 @@ ZSTD_getMatchPrice(U32 const offcode,
int
const
optLevel
)
int
const
optLevel
)
{
{
U32
price
;
U32
price
;
U32
const
offCode
=
ZSTD_highbit32
(
offcode
+
1
);
U32
const
offCode
=
ZSTD_highbit32
(
STORED_TO_OFFBASE
(
offcode
)
);
U32
const
mlBase
=
matchLength
-
MINMATCH
;
U32
const
mlBase
=
matchLength
-
MINMATCH
;
assert
(
matchLength
>=
MINMATCH
);
assert
(
matchLength
>=
MINMATCH
);
...
@@ -333,8 +335,8 @@ static void ZSTD_updateStats(optState_t* const optPtr,
...
@@ -333,8 +335,8 @@ static void ZSTD_updateStats(optState_t* const optPtr,
optPtr
->
litLengthSum
++
;
optPtr
->
litLengthSum
++
;
}
}
/*
match
offset code
(0-2=>repCode; 3+=>offset+2)
*/
/* offset code
: expected to follow storeSeq() numeric representation
*/
{
U32
const
offCode
=
ZSTD_highbit32
(
offsetCode
+
1
);
{
U32
const
offCode
=
ZSTD_highbit32
(
STORED_TO_OFFBASE
(
offsetCode
)
);
assert
(
offCode
<=
MaxOff
);
assert
(
offCode
<=
MaxOff
);
optPtr
->
offCodeFreq
[
offCode
]
++
;
optPtr
->
offCodeFreq
[
offCode
]
++
;
optPtr
->
offCodeSum
++
;
optPtr
->
offCodeSum
++
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment