/src/c-blosc/internal-complibs/zstd-1.5.6/common/bits.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) Meta Platforms, Inc. and affiliates. |
3 | | * All rights reserved. |
4 | | * |
5 | | * This source code is licensed under both the BSD-style license (found in the |
6 | | * LICENSE file in the root directory of this source tree) and the GPLv2 (found |
7 | | * in the COPYING file in the root directory of this source tree). |
8 | | * You may select, at your option, one of the above-listed licenses. |
9 | | */ |
10 | | |
11 | | #ifndef ZSTD_BITS_H |
12 | | #define ZSTD_BITS_H |
13 | | |
14 | | #include "mem.h" |
15 | | |
16 | | MEM_STATIC unsigned ZSTD_countTrailingZeros32_fallback(U32 val) |
17 | 0 | { |
18 | 0 | assert(val != 0); |
19 | 0 | { |
20 | 0 | static const U32 DeBruijnBytePos[32] = {0, 1, 28, 2, 29, 14, 24, 3, |
21 | 0 | 30, 22, 20, 15, 25, 17, 4, 8, |
22 | 0 | 31, 27, 13, 23, 21, 19, 16, 7, |
23 | 0 | 26, 12, 18, 6, 11, 5, 10, 9}; |
24 | 0 | return DeBruijnBytePos[((U32) ((val & -(S32) val) * 0x077CB531U)) >> 27]; |
25 | 0 | } |
26 | 0 | } Unexecuted instantiation: zstd_common.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_compress.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_compress_literals.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_double_fast.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_fast.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_lazy.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_ldm.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_opt.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_decompress.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_decompress_block.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: entropy_common.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: fse_decompress.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: fse_compress.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: huf_compress.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: huf_decompress.c:ZSTD_countTrailingZeros32_fallback Unexecuted instantiation: zstd_ddict.c:ZSTD_countTrailingZeros32_fallback |
27 | | |
28 | | MEM_STATIC unsigned ZSTD_countTrailingZeros32(U32 val) |
29 | 3.50k | { |
30 | 3.50k | assert(val != 0); |
31 | | # if defined(_MSC_VER) |
32 | | # if STATIC_BMI2 == 1 |
33 | | return (unsigned)_tzcnt_u32(val); |
34 | | # else |
35 | | if (val != 0) { |
36 | | unsigned long r; |
37 | | _BitScanForward(&r, val); |
38 | | return (unsigned)r; |
39 | | } else { |
40 | | /* Should not reach this code path */ |
41 | | __assume(0); |
42 | | } |
43 | | # endif |
44 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) |
45 | | return (unsigned)__builtin_ctz(val); |
46 | | # else |
47 | | return ZSTD_countTrailingZeros32_fallback(val); |
48 | | # endif |
49 | 3.50k | } Unexecuted instantiation: zstd_common.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_compress.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_double_fast.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_fast.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_lazy.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_ldm.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_opt.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_decompress.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_decompress_block.c:ZSTD_countTrailingZeros32 entropy_common.c:ZSTD_countTrailingZeros32 Line | Count | Source | 29 | 3.50k | { | 30 | 3.50k | assert(val != 0); | 31 | | # if defined(_MSC_VER) | 32 | | # if STATIC_BMI2 == 1 | 33 | | return (unsigned)_tzcnt_u32(val); | 34 | | # else | 35 | | if (val != 0) { | 36 | | unsigned long r; | 37 | | _BitScanForward(&r, val); | 38 | | return (unsigned)r; | 39 | | } else { | 40 | | /* Should not reach this code path */ | 41 | | __assume(0); | 42 | | } | 43 | | # endif | 44 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) | 45 | | return (unsigned)__builtin_ctz(val); | 46 | | # else | 47 | | return ZSTD_countTrailingZeros32_fallback(val); | 48 | | # endif | 49 | 3.50k | } |
Unexecuted instantiation: fse_decompress.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: fse_compress.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: huf_compress.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: huf_decompress.c:ZSTD_countTrailingZeros32 Unexecuted instantiation: zstd_ddict.c:ZSTD_countTrailingZeros32 |
50 | | |
51 | 0 | MEM_STATIC unsigned ZSTD_countLeadingZeros32_fallback(U32 val) { |
52 | 0 | assert(val != 0); |
53 | 0 | { |
54 | 0 | static const U32 DeBruijnClz[32] = {0, 9, 1, 10, 13, 21, 2, 29, |
55 | 0 | 11, 14, 16, 18, 22, 25, 3, 30, |
56 | 0 | 8, 12, 20, 28, 15, 17, 24, 7, |
57 | 0 | 19, 27, 23, 6, 26, 5, 4, 31}; |
58 | 0 | val |= val >> 1; |
59 | 0 | val |= val >> 2; |
60 | 0 | val |= val >> 4; |
61 | 0 | val |= val >> 8; |
62 | 0 | val |= val >> 16; |
63 | 0 | return 31 - DeBruijnClz[(val * 0x07C4ACDDU) >> 27]; |
64 | 0 | } |
65 | 0 | } Unexecuted instantiation: zstd_common.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_compress.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_compress_literals.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_double_fast.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_fast.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_lazy.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_ldm.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_opt.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_decompress.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_decompress_block.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: entropy_common.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: fse_decompress.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: fse_compress.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: huf_compress.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: huf_decompress.c:ZSTD_countLeadingZeros32_fallback Unexecuted instantiation: zstd_ddict.c:ZSTD_countLeadingZeros32_fallback |
66 | | |
67 | | MEM_STATIC unsigned ZSTD_countLeadingZeros32(U32 val) |
68 | 29.1G | { |
69 | 29.1G | assert(val != 0); |
70 | | # if defined(_MSC_VER) |
71 | | # if STATIC_BMI2 == 1 |
72 | | return (unsigned)_lzcnt_u32(val); |
73 | | # else |
74 | | if (val != 0) { |
75 | | unsigned long r; |
76 | | _BitScanReverse(&r, val); |
77 | | return (unsigned)(31 - r); |
78 | | } else { |
79 | | /* Should not reach this code path */ |
80 | | __assume(0); |
81 | | } |
82 | | # endif |
83 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) |
84 | | return (unsigned)__builtin_clz(val); |
85 | | # else |
86 | | return ZSTD_countLeadingZeros32_fallback(val); |
87 | | # endif |
88 | 29.1G | } Unexecuted instantiation: zstd_common.c:ZSTD_countLeadingZeros32 zstd_compress.c:ZSTD_countLeadingZeros32 Line | Count | Source | 68 | 17.5M | { | 69 | 17.5M | assert(val != 0); | 70 | | # if defined(_MSC_VER) | 71 | | # if STATIC_BMI2 == 1 | 72 | | return (unsigned)_lzcnt_u32(val); | 73 | | # else | 74 | | if (val != 0) { | 75 | | unsigned long r; | 76 | | _BitScanReverse(&r, val); | 77 | | return (unsigned)(31 - r); | 78 | | } else { | 79 | | /* Should not reach this code path */ | 80 | | __assume(0); | 81 | | } | 82 | | # endif | 83 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) | 84 | | return (unsigned)__builtin_clz(val); | 85 | | # else | 86 | | return ZSTD_countLeadingZeros32_fallback(val); | 87 | | # endif | 88 | 17.5M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_countLeadingZeros32 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_countLeadingZeros32 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_countLeadingZeros32 Unexecuted instantiation: zstd_double_fast.c:ZSTD_countLeadingZeros32 Unexecuted instantiation: zstd_fast.c:ZSTD_countLeadingZeros32 zstd_lazy.c:ZSTD_countLeadingZeros32 Line | Count | Source | 68 | 35.1M | { | 69 | 35.1M | assert(val != 0); | 70 | | # if defined(_MSC_VER) | 71 | | # if STATIC_BMI2 == 1 | 72 | | return (unsigned)_lzcnt_u32(val); | 73 | | # else | 74 | | if (val != 0) { | 75 | | unsigned long r; | 76 | | _BitScanReverse(&r, val); | 77 | | return (unsigned)(31 - r); | 78 | | } else { | 79 | | /* Should not reach this code path */ | 80 | | __assume(0); | 81 | | } | 82 | | # endif | 83 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) | 84 | | return (unsigned)__builtin_clz(val); | 85 | | # else | 86 | | return ZSTD_countLeadingZeros32_fallback(val); | 87 | | # endif | 88 | 35.1M | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_countLeadingZeros32 zstd_opt.c:ZSTD_countLeadingZeros32 Line | Count | Source | 68 | 28.9G | { | 69 | 28.9G | assert(val != 0); | 70 | | # if defined(_MSC_VER) | 71 | | # if STATIC_BMI2 == 1 | 72 | | return (unsigned)_lzcnt_u32(val); | 73 | | # else | 74 | | if (val != 0) { | 75 | | unsigned long r; | 76 | | _BitScanReverse(&r, val); | 77 | | return (unsigned)(31 - r); | 78 | | } else { | 79 | | /* Should not reach this code path */ | 80 | | __assume(0); | 81 | | } | 82 | | # endif | 83 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) | 84 | | return (unsigned)__builtin_clz(val); | 85 | | # else | 86 | | return ZSTD_countLeadingZeros32_fallback(val); | 87 | | # endif | 88 | 28.9G | } |
Unexecuted instantiation: zstd_decompress.c:ZSTD_countLeadingZeros32 zstd_decompress_block.c:ZSTD_countLeadingZeros32 Line | Count | Source | 68 | 90.4k | { | 69 | 90.4k | assert(val != 0); | 70 | | # if defined(_MSC_VER) | 71 | | # if STATIC_BMI2 == 1 | 72 | | return (unsigned)_lzcnt_u32(val); | 73 | | # else | 74 | | if (val != 0) { | 75 | | unsigned long r; | 76 | | _BitScanReverse(&r, val); | 77 | | return (unsigned)(31 - r); | 78 | | } else { | 79 | | /* Should not reach this code path */ | 80 | | __assume(0); | 81 | | } | 82 | | # endif | 83 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) | 84 | | return (unsigned)__builtin_clz(val); | 85 | | # else | 86 | | return ZSTD_countLeadingZeros32_fallback(val); | 87 | | # endif | 88 | 90.4k | } |
entropy_common.c:ZSTD_countLeadingZeros32 Line | Count | Source | 68 | 15.1k | { | 69 | 15.1k | assert(val != 0); | 70 | | # if defined(_MSC_VER) | 71 | | # if STATIC_BMI2 == 1 | 72 | | return (unsigned)_lzcnt_u32(val); | 73 | | # else | 74 | | if (val != 0) { | 75 | | unsigned long r; | 76 | | _BitScanReverse(&r, val); | 77 | | return (unsigned)(31 - r); | 78 | | } else { | 79 | | /* Should not reach this code path */ | 80 | | __assume(0); | 81 | | } | 82 | | # endif | 83 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) | 84 | | return (unsigned)__builtin_clz(val); | 85 | | # else | 86 | | return ZSTD_countLeadingZeros32_fallback(val); | 87 | | # endif | 88 | 15.1k | } |
fse_decompress.c:ZSTD_countLeadingZeros32 Line | Count | Source | 68 | 50.6k | { | 69 | 50.6k | assert(val != 0); | 70 | | # if defined(_MSC_VER) | 71 | | # if STATIC_BMI2 == 1 | 72 | | return (unsigned)_lzcnt_u32(val); | 73 | | # else | 74 | | if (val != 0) { | 75 | | unsigned long r; | 76 | | _BitScanReverse(&r, val); | 77 | | return (unsigned)(31 - r); | 78 | | } else { | 79 | | /* Should not reach this code path */ | 80 | | __assume(0); | 81 | | } | 82 | | # endif | 83 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) | 84 | | return (unsigned)__builtin_clz(val); | 85 | | # else | 86 | | return ZSTD_countLeadingZeros32_fallback(val); | 87 | | # endif | 88 | 50.6k | } |
fse_compress.c:ZSTD_countLeadingZeros32 Line | Count | Source | 68 | 5.28M | { | 69 | 5.28M | assert(val != 0); | 70 | | # if defined(_MSC_VER) | 71 | | # if STATIC_BMI2 == 1 | 72 | | return (unsigned)_lzcnt_u32(val); | 73 | | # else | 74 | | if (val != 0) { | 75 | | unsigned long r; | 76 | | _BitScanReverse(&r, val); | 77 | | return (unsigned)(31 - r); | 78 | | } else { | 79 | | /* Should not reach this code path */ | 80 | | __assume(0); | 81 | | } | 82 | | # endif | 83 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) | 84 | | return (unsigned)__builtin_clz(val); | 85 | | # else | 86 | | return ZSTD_countLeadingZeros32_fallback(val); | 87 | | # endif | 88 | 5.28M | } |
huf_compress.c:ZSTD_countLeadingZeros32 Line | Count | Source | 68 | 67.8M | { | 69 | 67.8M | assert(val != 0); | 70 | | # if defined(_MSC_VER) | 71 | | # if STATIC_BMI2 == 1 | 72 | | return (unsigned)_lzcnt_u32(val); | 73 | | # else | 74 | | if (val != 0) { | 75 | | unsigned long r; | 76 | | _BitScanReverse(&r, val); | 77 | | return (unsigned)(31 - r); | 78 | | } else { | 79 | | /* Should not reach this code path */ | 80 | | __assume(0); | 81 | | } | 82 | | # endif | 83 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) | 84 | | return (unsigned)__builtin_clz(val); | 85 | | # else | 86 | | return ZSTD_countLeadingZeros32_fallback(val); | 87 | | # endif | 88 | 67.8M | } |
huf_decompress.c:ZSTD_countLeadingZeros32 Line | Count | Source | 68 | 6.14k | { | 69 | 6.14k | assert(val != 0); | 70 | | # if defined(_MSC_VER) | 71 | | # if STATIC_BMI2 == 1 | 72 | | return (unsigned)_lzcnt_u32(val); | 73 | | # else | 74 | | if (val != 0) { | 75 | | unsigned long r; | 76 | | _BitScanReverse(&r, val); | 77 | | return (unsigned)(31 - r); | 78 | | } else { | 79 | | /* Should not reach this code path */ | 80 | | __assume(0); | 81 | | } | 82 | | # endif | 83 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) | 84 | | return (unsigned)__builtin_clz(val); | 85 | | # else | 86 | | return ZSTD_countLeadingZeros32_fallback(val); | 87 | | # endif | 88 | 6.14k | } |
Unexecuted instantiation: zstd_ddict.c:ZSTD_countLeadingZeros32 |
89 | | |
90 | | MEM_STATIC unsigned ZSTD_countTrailingZeros64(U64 val) |
91 | 2.12G | { |
92 | 2.12G | assert(val != 0); |
93 | | # if defined(_MSC_VER) && defined(_WIN64) |
94 | | # if STATIC_BMI2 == 1 |
95 | | return (unsigned)_tzcnt_u64(val); |
96 | | # else |
97 | | if (val != 0) { |
98 | | unsigned long r; |
99 | | _BitScanForward64(&r, val); |
100 | | return (unsigned)r; |
101 | | } else { |
102 | | /* Should not reach this code path */ |
103 | | __assume(0); |
104 | | } |
105 | | # endif |
106 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__) |
107 | | return (unsigned)__builtin_ctzll(val); |
108 | | # else |
109 | | { |
110 | | U32 mostSignificantWord = (U32)(val >> 32); |
111 | | U32 leastSignificantWord = (U32)val; |
112 | | if (leastSignificantWord == 0) { |
113 | | return 32 + ZSTD_countTrailingZeros32(mostSignificantWord); |
114 | | } else { |
115 | | return ZSTD_countTrailingZeros32(leastSignificantWord); |
116 | | } |
117 | | } |
118 | | # endif |
119 | 2.12G | } Unexecuted instantiation: zstd_common.c:ZSTD_countTrailingZeros64 Unexecuted instantiation: zstd_compress.c:ZSTD_countTrailingZeros64 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_countTrailingZeros64 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_countTrailingZeros64 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_countTrailingZeros64 zstd_double_fast.c:ZSTD_countTrailingZeros64 Line | Count | Source | 91 | 4.58M | { | 92 | 4.58M | assert(val != 0); | 93 | | # if defined(_MSC_VER) && defined(_WIN64) | 94 | | # if STATIC_BMI2 == 1 | 95 | | return (unsigned)_tzcnt_u64(val); | 96 | | # else | 97 | | if (val != 0) { | 98 | | unsigned long r; | 99 | | _BitScanForward64(&r, val); | 100 | | return (unsigned)r; | 101 | | } else { | 102 | | /* Should not reach this code path */ | 103 | | __assume(0); | 104 | | } | 105 | | # endif | 106 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__) | 107 | | return (unsigned)__builtin_ctzll(val); | 108 | | # else | 109 | | { | 110 | | U32 mostSignificantWord = (U32)(val >> 32); | 111 | | U32 leastSignificantWord = (U32)val; | 112 | | if (leastSignificantWord == 0) { | 113 | | return 32 + ZSTD_countTrailingZeros32(mostSignificantWord); | 114 | | } else { | 115 | | return ZSTD_countTrailingZeros32(leastSignificantWord); | 116 | | } | 117 | | } | 118 | | # endif | 119 | 4.58M | } |
zstd_fast.c:ZSTD_countTrailingZeros64 Line | Count | Source | 91 | 2.18M | { | 92 | 2.18M | assert(val != 0); | 93 | | # if defined(_MSC_VER) && defined(_WIN64) | 94 | | # if STATIC_BMI2 == 1 | 95 | | return (unsigned)_tzcnt_u64(val); | 96 | | # else | 97 | | if (val != 0) { | 98 | | unsigned long r; | 99 | | _BitScanForward64(&r, val); | 100 | | return (unsigned)r; | 101 | | } else { | 102 | | /* Should not reach this code path */ | 103 | | __assume(0); | 104 | | } | 105 | | # endif | 106 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__) | 107 | | return (unsigned)__builtin_ctzll(val); | 108 | | # else | 109 | | { | 110 | | U32 mostSignificantWord = (U32)(val >> 32); | 111 | | U32 leastSignificantWord = (U32)val; | 112 | | if (leastSignificantWord == 0) { | 113 | | return 32 + ZSTD_countTrailingZeros32(mostSignificantWord); | 114 | | } else { | 115 | | return ZSTD_countTrailingZeros32(leastSignificantWord); | 116 | | } | 117 | | } | 118 | | # endif | 119 | 2.18M | } |
zstd_lazy.c:ZSTD_countTrailingZeros64 Line | Count | Source | 91 | 97.6M | { | 92 | 97.6M | assert(val != 0); | 93 | | # if defined(_MSC_VER) && defined(_WIN64) | 94 | | # if STATIC_BMI2 == 1 | 95 | | return (unsigned)_tzcnt_u64(val); | 96 | | # else | 97 | | if (val != 0) { | 98 | | unsigned long r; | 99 | | _BitScanForward64(&r, val); | 100 | | return (unsigned)r; | 101 | | } else { | 102 | | /* Should not reach this code path */ | 103 | | __assume(0); | 104 | | } | 105 | | # endif | 106 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__) | 107 | | return (unsigned)__builtin_ctzll(val); | 108 | | # else | 109 | | { | 110 | | U32 mostSignificantWord = (U32)(val >> 32); | 111 | | U32 leastSignificantWord = (U32)val; | 112 | | if (leastSignificantWord == 0) { | 113 | | return 32 + ZSTD_countTrailingZeros32(mostSignificantWord); | 114 | | } else { | 115 | | return ZSTD_countTrailingZeros32(leastSignificantWord); | 116 | | } | 117 | | } | 118 | | # endif | 119 | 97.6M | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_countTrailingZeros64 zstd_opt.c:ZSTD_countTrailingZeros64 Line | Count | Source | 91 | 2.01G | { | 92 | 2.01G | assert(val != 0); | 93 | | # if defined(_MSC_VER) && defined(_WIN64) | 94 | | # if STATIC_BMI2 == 1 | 95 | | return (unsigned)_tzcnt_u64(val); | 96 | | # else | 97 | | if (val != 0) { | 98 | | unsigned long r; | 99 | | _BitScanForward64(&r, val); | 100 | | return (unsigned)r; | 101 | | } else { | 102 | | /* Should not reach this code path */ | 103 | | __assume(0); | 104 | | } | 105 | | # endif | 106 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__) | 107 | | return (unsigned)__builtin_ctzll(val); | 108 | | # else | 109 | | { | 110 | | U32 mostSignificantWord = (U32)(val >> 32); | 111 | | U32 leastSignificantWord = (U32)val; | 112 | | if (leastSignificantWord == 0) { | 113 | | return 32 + ZSTD_countTrailingZeros32(mostSignificantWord); | 114 | | } else { | 115 | | return ZSTD_countTrailingZeros32(leastSignificantWord); | 116 | | } | 117 | | } | 118 | | # endif | 119 | 2.01G | } |
Unexecuted instantiation: zstd_decompress.c:ZSTD_countTrailingZeros64 Unexecuted instantiation: zstd_decompress_block.c:ZSTD_countTrailingZeros64 Unexecuted instantiation: entropy_common.c:ZSTD_countTrailingZeros64 Unexecuted instantiation: fse_decompress.c:ZSTD_countTrailingZeros64 Unexecuted instantiation: fse_compress.c:ZSTD_countTrailingZeros64 Unexecuted instantiation: huf_compress.c:ZSTD_countTrailingZeros64 huf_decompress.c:ZSTD_countTrailingZeros64 Line | Count | Source | 91 | 6.14k | { | 92 | 6.14k | assert(val != 0); | 93 | | # if defined(_MSC_VER) && defined(_WIN64) | 94 | | # if STATIC_BMI2 == 1 | 95 | | return (unsigned)_tzcnt_u64(val); | 96 | | # else | 97 | | if (val != 0) { | 98 | | unsigned long r; | 99 | | _BitScanForward64(&r, val); | 100 | | return (unsigned)r; | 101 | | } else { | 102 | | /* Should not reach this code path */ | 103 | | __assume(0); | 104 | | } | 105 | | # endif | 106 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) && defined(__LP64__) | 107 | | return (unsigned)__builtin_ctzll(val); | 108 | | # else | 109 | | { | 110 | | U32 mostSignificantWord = (U32)(val >> 32); | 111 | | U32 leastSignificantWord = (U32)val; | 112 | | if (leastSignificantWord == 0) { | 113 | | return 32 + ZSTD_countTrailingZeros32(mostSignificantWord); | 114 | | } else { | 115 | | return ZSTD_countTrailingZeros32(leastSignificantWord); | 116 | | } | 117 | | } | 118 | | # endif | 119 | 6.14k | } |
Unexecuted instantiation: zstd_ddict.c:ZSTD_countTrailingZeros64 |
120 | | |
121 | | MEM_STATIC unsigned ZSTD_countLeadingZeros64(U64 val) |
122 | 0 | { |
123 | 0 | assert(val != 0); |
124 | | # if defined(_MSC_VER) && defined(_WIN64) |
125 | | # if STATIC_BMI2 == 1 |
126 | | return (unsigned)_lzcnt_u64(val); |
127 | | # else |
128 | | if (val != 0) { |
129 | | unsigned long r; |
130 | | _BitScanReverse64(&r, val); |
131 | | return (unsigned)(63 - r); |
132 | | } else { |
133 | | /* Should not reach this code path */ |
134 | | __assume(0); |
135 | | } |
136 | | # endif |
137 | | # elif defined(__GNUC__) && (__GNUC__ >= 4) |
138 | | return (unsigned)(__builtin_clzll(val)); |
139 | | # else |
140 | | { |
141 | | U32 mostSignificantWord = (U32)(val >> 32); |
142 | | U32 leastSignificantWord = (U32)val; |
143 | | if (mostSignificantWord == 0) { |
144 | | return 32 + ZSTD_countLeadingZeros32(leastSignificantWord); |
145 | | } else { |
146 | | return ZSTD_countLeadingZeros32(mostSignificantWord); |
147 | | } |
148 | | } |
149 | | # endif |
150 | 0 | } Unexecuted instantiation: zstd_common.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_compress.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_double_fast.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_fast.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_lazy.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_ldm.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_opt.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_decompress.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_decompress_block.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: entropy_common.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: fse_decompress.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: fse_compress.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: huf_compress.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: huf_decompress.c:ZSTD_countLeadingZeros64 Unexecuted instantiation: zstd_ddict.c:ZSTD_countLeadingZeros64 |
151 | | |
152 | | MEM_STATIC unsigned ZSTD_NbCommonBytes(size_t val) |
153 | 2.07G | { |
154 | 2.07G | if (MEM_isLittleEndian()) { |
155 | 2.07G | if (MEM_64bits()) { |
156 | 2.07G | return ZSTD_countTrailingZeros64((U64)val) >> 3; |
157 | 2.07G | } else { |
158 | 0 | return ZSTD_countTrailingZeros32((U32)val) >> 3; |
159 | 0 | } |
160 | 2.07G | } else { /* Big Endian CPU */ |
161 | 0 | if (MEM_64bits()) { |
162 | 0 | return ZSTD_countLeadingZeros64((U64)val) >> 3; |
163 | 0 | } else { |
164 | 0 | return ZSTD_countLeadingZeros32((U32)val) >> 3; |
165 | 0 | } |
166 | 0 | } |
167 | 2.07G | } Unexecuted instantiation: zstd_common.c:ZSTD_NbCommonBytes Unexecuted instantiation: zstd_compress.c:ZSTD_NbCommonBytes Unexecuted instantiation: zstd_compress_literals.c:ZSTD_NbCommonBytes Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_NbCommonBytes Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_NbCommonBytes zstd_double_fast.c:ZSTD_NbCommonBytes Line | Count | Source | 153 | 4.58M | { | 154 | 4.58M | if (MEM_isLittleEndian()) { | 155 | 4.58M | if (MEM_64bits()) { | 156 | 4.58M | return ZSTD_countTrailingZeros64((U64)val) >> 3; | 157 | 4.58M | } else { | 158 | 0 | return ZSTD_countTrailingZeros32((U32)val) >> 3; | 159 | 0 | } | 160 | 4.58M | } else { /* Big Endian CPU */ | 161 | 0 | if (MEM_64bits()) { | 162 | 0 | return ZSTD_countLeadingZeros64((U64)val) >> 3; | 163 | 0 | } else { | 164 | 0 | return ZSTD_countLeadingZeros32((U32)val) >> 3; | 165 | 0 | } | 166 | 0 | } | 167 | 4.58M | } |
zstd_fast.c:ZSTD_NbCommonBytes Line | Count | Source | 153 | 2.18M | { | 154 | 2.18M | if (MEM_isLittleEndian()) { | 155 | 2.18M | if (MEM_64bits()) { | 156 | 2.18M | return ZSTD_countTrailingZeros64((U64)val) >> 3; | 157 | 2.18M | } else { | 158 | 0 | return ZSTD_countTrailingZeros32((U32)val) >> 3; | 159 | 0 | } | 160 | 2.18M | } else { /* Big Endian CPU */ | 161 | 0 | if (MEM_64bits()) { | 162 | 0 | return ZSTD_countLeadingZeros64((U64)val) >> 3; | 163 | 0 | } else { | 164 | 0 | return ZSTD_countLeadingZeros32((U32)val) >> 3; | 165 | 0 | } | 166 | 0 | } | 167 | 2.18M | } |
zstd_lazy.c:ZSTD_NbCommonBytes Line | Count | Source | 153 | 55.9M | { | 154 | 55.9M | if (MEM_isLittleEndian()) { | 155 | 55.9M | if (MEM_64bits()) { | 156 | 55.9M | return ZSTD_countTrailingZeros64((U64)val) >> 3; | 157 | 55.9M | } else { | 158 | 0 | return ZSTD_countTrailingZeros32((U32)val) >> 3; | 159 | 0 | } | 160 | 55.9M | } else { /* Big Endian CPU */ | 161 | 0 | if (MEM_64bits()) { | 162 | 0 | return ZSTD_countLeadingZeros64((U64)val) >> 3; | 163 | 0 | } else { | 164 | 0 | return ZSTD_countLeadingZeros32((U32)val) >> 3; | 165 | 0 | } | 166 | 0 | } | 167 | 55.9M | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_NbCommonBytes zstd_opt.c:ZSTD_NbCommonBytes Line | Count | Source | 153 | 2.01G | { | 154 | 2.01G | if (MEM_isLittleEndian()) { | 155 | 2.01G | if (MEM_64bits()) { | 156 | 2.01G | return ZSTD_countTrailingZeros64((U64)val) >> 3; | 157 | 2.01G | } else { | 158 | 0 | return ZSTD_countTrailingZeros32((U32)val) >> 3; | 159 | 0 | } | 160 | 2.01G | } else { /* Big Endian CPU */ | 161 | 0 | if (MEM_64bits()) { | 162 | 0 | return ZSTD_countLeadingZeros64((U64)val) >> 3; | 163 | 0 | } else { | 164 | 0 | return ZSTD_countLeadingZeros32((U32)val) >> 3; | 165 | 0 | } | 166 | 0 | } | 167 | 2.01G | } |
Unexecuted instantiation: zstd_decompress.c:ZSTD_NbCommonBytes Unexecuted instantiation: zstd_decompress_block.c:ZSTD_NbCommonBytes Unexecuted instantiation: entropy_common.c:ZSTD_NbCommonBytes Unexecuted instantiation: fse_decompress.c:ZSTD_NbCommonBytes Unexecuted instantiation: fse_compress.c:ZSTD_NbCommonBytes Unexecuted instantiation: huf_compress.c:ZSTD_NbCommonBytes Unexecuted instantiation: huf_decompress.c:ZSTD_NbCommonBytes Unexecuted instantiation: zstd_ddict.c:ZSTD_NbCommonBytes |
168 | | |
169 | | MEM_STATIC unsigned ZSTD_highbit32(U32 val) /* compress, dictBuilder, decodeCorpus */ |
170 | 29.1G | { |
171 | 29.1G | assert(val != 0); |
172 | 29.1G | return 31 - ZSTD_countLeadingZeros32(val); |
173 | 29.1G | } Unexecuted instantiation: zstd_common.c:ZSTD_highbit32 zstd_compress.c:ZSTD_highbit32 Line | Count | Source | 170 | 17.5M | { | 171 | 17.5M | assert(val != 0); | 172 | 17.5M | return 31 - ZSTD_countLeadingZeros32(val); | 173 | 17.5M | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_highbit32 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_highbit32 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_highbit32 Unexecuted instantiation: zstd_double_fast.c:ZSTD_highbit32 Unexecuted instantiation: zstd_fast.c:ZSTD_highbit32 zstd_lazy.c:ZSTD_highbit32 Line | Count | Source | 170 | 35.1M | { | 171 | 35.1M | assert(val != 0); | 172 | 35.1M | return 31 - ZSTD_countLeadingZeros32(val); | 173 | 35.1M | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_highbit32 zstd_opt.c:ZSTD_highbit32 Line | Count | Source | 170 | 28.9G | { | 171 | 28.9G | assert(val != 0); | 172 | 28.9G | return 31 - ZSTD_countLeadingZeros32(val); | 173 | 28.9G | } |
Unexecuted instantiation: zstd_decompress.c:ZSTD_highbit32 zstd_decompress_block.c:ZSTD_highbit32 Line | Count | Source | 170 | 90.4k | { | 171 | 90.4k | assert(val != 0); | 172 | 90.4k | return 31 - ZSTD_countLeadingZeros32(val); | 173 | 90.4k | } |
entropy_common.c:ZSTD_highbit32 Line | Count | Source | 170 | 15.1k | { | 171 | 15.1k | assert(val != 0); | 172 | 15.1k | return 31 - ZSTD_countLeadingZeros32(val); | 173 | 15.1k | } |
fse_decompress.c:ZSTD_highbit32 Line | Count | Source | 170 | 50.6k | { | 171 | 50.6k | assert(val != 0); | 172 | 50.6k | return 31 - ZSTD_countLeadingZeros32(val); | 173 | 50.6k | } |
fse_compress.c:ZSTD_highbit32 Line | Count | Source | 170 | 5.28M | { | 171 | 5.28M | assert(val != 0); | 172 | 5.28M | return 31 - ZSTD_countLeadingZeros32(val); | 173 | 5.28M | } |
huf_compress.c:ZSTD_highbit32 Line | Count | Source | 170 | 67.8M | { | 171 | 67.8M | assert(val != 0); | 172 | 67.8M | return 31 - ZSTD_countLeadingZeros32(val); | 173 | 67.8M | } |
huf_decompress.c:ZSTD_highbit32 Line | Count | Source | 170 | 6.14k | { | 171 | 6.14k | assert(val != 0); | 172 | 6.14k | return 31 - ZSTD_countLeadingZeros32(val); | 173 | 6.14k | } |
Unexecuted instantiation: zstd_ddict.c:ZSTD_highbit32 |
174 | | |
175 | | /* ZSTD_rotateRight_*(): |
176 | | * Rotates a bitfield to the right by "count" bits. |
177 | | * https://en.wikipedia.org/w/index.php?title=Circular_shift&oldid=991635599#Implementing_circular_shifts |
178 | | */ |
179 | | MEM_STATIC |
180 | 9.48k | U64 ZSTD_rotateRight_U64(U64 const value, U32 count) { |
181 | 9.48k | assert(count < 64); |
182 | 9.48k | count &= 0x3F; /* for fickle pattern recognition */ |
183 | 9.48k | return (value >> count) | (U64)(value << ((0U - count) & 0x3F)); |
184 | 9.48k | } Unexecuted instantiation: zstd_common.c:ZSTD_rotateRight_U64 zstd_compress.c:ZSTD_rotateRight_U64 Line | Count | Source | 180 | 9.48k | U64 ZSTD_rotateRight_U64(U64 const value, U32 count) { | 181 | 9.48k | assert(count < 64); | 182 | 9.48k | count &= 0x3F; /* for fickle pattern recognition */ | 183 | 9.48k | return (value >> count) | (U64)(value << ((0U - count) & 0x3F)); | 184 | 9.48k | } |
Unexecuted instantiation: zstd_compress_literals.c:ZSTD_rotateRight_U64 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_rotateRight_U64 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_rotateRight_U64 Unexecuted instantiation: zstd_double_fast.c:ZSTD_rotateRight_U64 Unexecuted instantiation: zstd_fast.c:ZSTD_rotateRight_U64 Unexecuted instantiation: zstd_lazy.c:ZSTD_rotateRight_U64 Unexecuted instantiation: zstd_ldm.c:ZSTD_rotateRight_U64 Unexecuted instantiation: zstd_opt.c:ZSTD_rotateRight_U64 Unexecuted instantiation: zstd_decompress.c:ZSTD_rotateRight_U64 Unexecuted instantiation: zstd_decompress_block.c:ZSTD_rotateRight_U64 Unexecuted instantiation: entropy_common.c:ZSTD_rotateRight_U64 Unexecuted instantiation: fse_decompress.c:ZSTD_rotateRight_U64 Unexecuted instantiation: fse_compress.c:ZSTD_rotateRight_U64 Unexecuted instantiation: huf_compress.c:ZSTD_rotateRight_U64 Unexecuted instantiation: huf_decompress.c:ZSTD_rotateRight_U64 Unexecuted instantiation: zstd_ddict.c:ZSTD_rotateRight_U64 |
185 | | |
186 | | MEM_STATIC |
187 | 8.47M | U32 ZSTD_rotateRight_U32(U32 const value, U32 count) { |
188 | 8.47M | assert(count < 32); |
189 | 8.47M | count &= 0x1F; /* for fickle pattern recognition */ |
190 | 8.47M | return (value >> count) | (U32)(value << ((0U - count) & 0x1F)); |
191 | 8.47M | } Unexecuted instantiation: zstd_common.c:ZSTD_rotateRight_U32 Unexecuted instantiation: zstd_compress.c:ZSTD_rotateRight_U32 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_rotateRight_U32 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_rotateRight_U32 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_rotateRight_U32 Unexecuted instantiation: zstd_double_fast.c:ZSTD_rotateRight_U32 Unexecuted instantiation: zstd_fast.c:ZSTD_rotateRight_U32 zstd_lazy.c:ZSTD_rotateRight_U32 Line | Count | Source | 187 | 8.47M | U32 ZSTD_rotateRight_U32(U32 const value, U32 count) { | 188 | 8.47M | assert(count < 32); | 189 | 8.47M | count &= 0x1F; /* for fickle pattern recognition */ | 190 | 8.47M | return (value >> count) | (U32)(value << ((0U - count) & 0x1F)); | 191 | 8.47M | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_rotateRight_U32 Unexecuted instantiation: zstd_opt.c:ZSTD_rotateRight_U32 Unexecuted instantiation: zstd_decompress.c:ZSTD_rotateRight_U32 Unexecuted instantiation: zstd_decompress_block.c:ZSTD_rotateRight_U32 Unexecuted instantiation: entropy_common.c:ZSTD_rotateRight_U32 Unexecuted instantiation: fse_decompress.c:ZSTD_rotateRight_U32 Unexecuted instantiation: fse_compress.c:ZSTD_rotateRight_U32 Unexecuted instantiation: huf_compress.c:ZSTD_rotateRight_U32 Unexecuted instantiation: huf_decompress.c:ZSTD_rotateRight_U32 Unexecuted instantiation: zstd_ddict.c:ZSTD_rotateRight_U32 |
192 | | |
193 | | MEM_STATIC |
194 | 16.0M | U16 ZSTD_rotateRight_U16(U16 const value, U32 count) { |
195 | 16.0M | assert(count < 16); |
196 | 16.0M | count &= 0x0F; /* for fickle pattern recognition */ |
197 | 16.0M | return (value >> count) | (U16)(value << ((0U - count) & 0x0F)); |
198 | 16.0M | } Unexecuted instantiation: zstd_common.c:ZSTD_rotateRight_U16 Unexecuted instantiation: zstd_compress.c:ZSTD_rotateRight_U16 Unexecuted instantiation: zstd_compress_literals.c:ZSTD_rotateRight_U16 Unexecuted instantiation: zstd_compress_sequences.c:ZSTD_rotateRight_U16 Unexecuted instantiation: zstd_compress_superblock.c:ZSTD_rotateRight_U16 Unexecuted instantiation: zstd_double_fast.c:ZSTD_rotateRight_U16 Unexecuted instantiation: zstd_fast.c:ZSTD_rotateRight_U16 zstd_lazy.c:ZSTD_rotateRight_U16 Line | Count | Source | 194 | 16.0M | U16 ZSTD_rotateRight_U16(U16 const value, U32 count) { | 195 | 16.0M | assert(count < 16); | 196 | 16.0M | count &= 0x0F; /* for fickle pattern recognition */ | 197 | 16.0M | return (value >> count) | (U16)(value << ((0U - count) & 0x0F)); | 198 | 16.0M | } |
Unexecuted instantiation: zstd_ldm.c:ZSTD_rotateRight_U16 Unexecuted instantiation: zstd_opt.c:ZSTD_rotateRight_U16 Unexecuted instantiation: zstd_decompress.c:ZSTD_rotateRight_U16 Unexecuted instantiation: zstd_decompress_block.c:ZSTD_rotateRight_U16 Unexecuted instantiation: entropy_common.c:ZSTD_rotateRight_U16 Unexecuted instantiation: fse_decompress.c:ZSTD_rotateRight_U16 Unexecuted instantiation: fse_compress.c:ZSTD_rotateRight_U16 Unexecuted instantiation: huf_compress.c:ZSTD_rotateRight_U16 Unexecuted instantiation: huf_decompress.c:ZSTD_rotateRight_U16 Unexecuted instantiation: zstd_ddict.c:ZSTD_rotateRight_U16 |
199 | | |
200 | | #endif /* ZSTD_BITS_H */ |