Skip to content

Commit c3f04cd

Browse files
committed
Use U32 for extract index
1 parent a5bf3dd commit c3f04cd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/compress/zstd_compress_internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,8 +1096,8 @@ MEM_STATIC FORCE_INLINE_ATTR size_t ZSTD_extractHash(size_t hashAndTag, U32 tagB
10961096
return hashAndTag & (((U64)1 << hashBits) - 1);
10971097
}
10981098

1099-
MEM_STATIC FORCE_INLINE_ATTR size_t ZSTD_extractIndex(size_t indexAndTag, U32 tagBits) {
1100-
return indexAndTag & (((U32)1 << (32 - tagBits)) - 1);
1099+
MEM_STATIC FORCE_INLINE_ATTR U32 ZSTD_extractIndex(size_t indexAndTag, U32 tagBits) {
1100+
return (U32)(indexAndTag & (((U32)1 << (32 - tagBits)) - 1));
11011101
}
11021102

11031103
MEM_STATIC FORCE_INLINE_ATTR U32 ZSTD_extractTagFromHash(size_t hashAndTag, U32 tagBits, U32 hashBits) {
@@ -1122,8 +1122,8 @@ MEM_STATIC FORCE_INLINE_ATTR size_t ZSTD_extractHash(size_t hashAndTag, U32 tagB
11221122
return hashAndTag >> tagBits;
11231123
}
11241124

1125-
MEM_STATIC FORCE_INLINE_ATTR size_t ZSTD_extractIndex(size_t indexAndTag, U32 tagBits) {
1126-
return ZSTD_extractHash(indexAndTag, tagBits, 0);
1125+
MEM_STATIC FORCE_INLINE_ATTR U32 ZSTD_extractIndex(size_t indexAndTag, U32 tagBits) {
1126+
return (U32)ZSTD_extractHash(indexAndTag, tagBits, 0);
11271127
}
11281128

11291129
MEM_STATIC FORCE_INLINE_ATTR U32 ZSTD_extractTagFromHash(size_t hashAndTag, U32 tagBits, U32 hashBits) {

0 commit comments

Comments
 (0)