mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Merge pull request #256 from gtsoul-tech/bug/cppcheckErrors
Bug/cppcheck errors (3 ,4 ,7 ,10,11) WIP
This commit is contained in:
commit
71fcade2ac
@ -79,21 +79,18 @@ static UNUSED
|
||||
const platform_t hs_current_platform_no_avx2 = {
|
||||
HS_PLATFORM_NOAVX2 |
|
||||
HS_PLATFORM_NOAVX512 |
|
||||
HS_PLATFORM_NOAVX512VBMI |
|
||||
0,
|
||||
HS_PLATFORM_NOAVX512VBMI
|
||||
};
|
||||
|
||||
static UNUSED
|
||||
const platform_t hs_current_platform_no_avx512 = {
|
||||
HS_PLATFORM_NOAVX512 |
|
||||
HS_PLATFORM_NOAVX512VBMI |
|
||||
0,
|
||||
HS_PLATFORM_NOAVX512VBMI
|
||||
};
|
||||
|
||||
static UNUSED
|
||||
const platform_t hs_current_platform_no_avx512vbmi = {
|
||||
HS_PLATFORM_NOAVX512VBMI |
|
||||
0,
|
||||
HS_PLATFORM_NOAVX512VBMI
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -52,14 +52,14 @@ u32 TeddyEngineDescription::getDefaultFloodSuffixLength() const {
|
||||
|
||||
void getTeddyDescriptions(vector<TeddyEngineDescription> *out) {
|
||||
static const TeddyEngineDef defns[] = {
|
||||
{ 3, 0 | HS_CPU_FEATURES_AVX2, 1, 16, false },
|
||||
{ 4, 0 | HS_CPU_FEATURES_AVX2, 1, 16, true },
|
||||
{ 5, 0 | HS_CPU_FEATURES_AVX2, 2, 16, false },
|
||||
{ 6, 0 | HS_CPU_FEATURES_AVX2, 2, 16, true },
|
||||
{ 7, 0 | HS_CPU_FEATURES_AVX2, 3, 16, false },
|
||||
{ 8, 0 | HS_CPU_FEATURES_AVX2, 3, 16, true },
|
||||
{ 9, 0 | HS_CPU_FEATURES_AVX2, 4, 16, false },
|
||||
{ 10, 0 | HS_CPU_FEATURES_AVX2, 4, 16, true },
|
||||
{ 3, HS_CPU_FEATURES_AVX2, 1, 16, false },
|
||||
{ 4, HS_CPU_FEATURES_AVX2, 1, 16, true },
|
||||
{ 5, HS_CPU_FEATURES_AVX2, 2, 16, false },
|
||||
{ 6, HS_CPU_FEATURES_AVX2, 2, 16, true },
|
||||
{ 7, HS_CPU_FEATURES_AVX2, 3, 16, false },
|
||||
{ 8, HS_CPU_FEATURES_AVX2, 3, 16, true },
|
||||
{ 9, HS_CPU_FEATURES_AVX2, 4, 16, false },
|
||||
{ 10, HS_CPU_FEATURES_AVX2, 4, 16, true },
|
||||
{ 11, 0, 1, 8, false },
|
||||
{ 12, 0, 1, 8, true },
|
||||
{ 13, 0, 2, 8, false },
|
||||
|
@ -1572,7 +1572,7 @@ u32 findMaxVarShift(const build_info &args, u32 nShifts) {
|
||||
static
|
||||
int getLimexScore(const build_info &args, u32 nShifts) {
|
||||
const NGHolder &h = args.h;
|
||||
u32 maxVarShift = nShifts;
|
||||
u32 maxVarShift;
|
||||
int score = 0;
|
||||
|
||||
score += SHIFT_COST * nShifts;
|
||||
|
@ -512,7 +512,7 @@ size_t find_last_bad(const struct mpv_kilopuff *kp, const u8 *buf,
|
||||
|
||||
verm_restart:;
|
||||
assert(buf[curr] == kp->u.verm.c);
|
||||
size_t test = curr;
|
||||
size_t test;
|
||||
if (curr + min_rep < length) {
|
||||
test = curr + min_rep;
|
||||
} else {
|
||||
@ -534,7 +534,7 @@ size_t find_last_bad(const struct mpv_kilopuff *kp, const u8 *buf,
|
||||
m128 hi = kp->u.shuf.mask_hi;
|
||||
shuf_restart:
|
||||
assert(do_single_shufti(lo, hi, buf[curr]));
|
||||
size_t test = curr;
|
||||
size_t test;
|
||||
if (curr + min_rep < length) {
|
||||
test = curr + min_rep;
|
||||
} else {
|
||||
@ -556,7 +556,7 @@ size_t find_last_bad(const struct mpv_kilopuff *kp, const u8 *buf,
|
||||
const m128 mask1 = kp->u.truffle.mask1;
|
||||
const m128 mask2 = kp->u.truffle.mask2;
|
||||
truffle_restart:;
|
||||
size_t test = curr;
|
||||
size_t test;
|
||||
if (curr + min_rep < length) {
|
||||
test = curr + min_rep;
|
||||
} else {
|
||||
@ -582,7 +582,7 @@ size_t find_last_bad(const struct mpv_kilopuff *kp, const u8 *buf,
|
||||
|
||||
nverm_restart:;
|
||||
assert(buf[curr] != kp->u.verm.c);
|
||||
size_t test = curr;
|
||||
size_t test;
|
||||
if (curr + min_rep < length) {
|
||||
test = curr + min_rep;
|
||||
} else {
|
||||
|
@ -165,9 +165,9 @@ void reformAnchoredRepeatsComponent(NGHolder &g,
|
||||
return;
|
||||
}
|
||||
|
||||
NFAVertex dotV = NGHolder::null_vertex();
|
||||
|
||||
set<NFAVertex> otherV;
|
||||
dotV = findReformable(g, compAnchoredStarts, otherV);
|
||||
NFAVertex dotV = findReformable(g, compAnchoredStarts, otherV);
|
||||
if (dotV == NGHolder::null_vertex()) {
|
||||
DEBUG_PRINTF("no candidate reformable dot found.\n");
|
||||
return;
|
||||
@ -268,9 +268,9 @@ void reformUnanchoredRepeatsComponent(NGHolder &g,
|
||||
}
|
||||
|
||||
while (true) {
|
||||
NFAVertex dotV = NGHolder::null_vertex();
|
||||
|
||||
set<NFAVertex> otherV;
|
||||
dotV = findReformable(g, compUnanchoredStarts, otherV);
|
||||
NFAVertex dotV = findReformable(g, compUnanchoredStarts, otherV);
|
||||
if (dotV == NGHolder::null_vertex()) {
|
||||
DEBUG_PRINTF("no candidate reformable dot found.\n");
|
||||
return;
|
||||
|
@ -1292,8 +1292,8 @@ bool doTreePlanningIntl(NGHolder &g,
|
||||
DEBUG_PRINTF("add mapped reporters for region %u\n", it->first);
|
||||
addMappedReporterVertices(it->second, g, copy_to_orig,
|
||||
plan.back().reporters);
|
||||
} while (it->second.optional && it != info.rend() &&
|
||||
(++it)->first > furthest->first);
|
||||
} while (it != info.rend() && it->second.optional &&
|
||||
(++it)->first > furthest->first);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1551,7 +1551,7 @@ bool doSomPlanning(NGHolder &g, bool stuck_in,
|
||||
DEBUG_PRINTF("region %u contributes reporters to last plan\n",
|
||||
it->first);
|
||||
addReporterVertices(it->second, g, plan.back().reporters);
|
||||
} while (it->second.optional && it != info.rend() &&
|
||||
} while (it != info.rend() && it->second.optional &&
|
||||
(++it)->first > furthest->first);
|
||||
|
||||
DEBUG_PRINTF("done!\n");
|
||||
|
@ -320,7 +320,7 @@ void ComponentRepeat::wireRepeats(GlushkovBuildState &bs) {
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("wiring up %d optional repeats\n", copies - m_min);
|
||||
DEBUG_PRINTF("wiring up %u optional repeats\n", copies - m_min);
|
||||
for (u32 rep = MAX(m_min, 1); rep < copies; rep++) {
|
||||
vector<PositionInfo> lasts = m_lasts[rep - 1];
|
||||
if (rep != m_min) {
|
||||
|
@ -62,7 +62,7 @@ u32 our_clzll(u64a x) {
|
||||
TEST(BitUtils, findAndClearLSB32_1) {
|
||||
// test that it can find every single-bit case
|
||||
for (unsigned int i = 0; i < 32; i++) {
|
||||
u32 input = 1 << i;
|
||||
u32 input = 1U << i;
|
||||
u32 idx = findAndClearLSB_32(&input);
|
||||
EXPECT_EQ(i, idx);
|
||||
EXPECT_EQ(0U, input);
|
||||
@ -112,7 +112,7 @@ TEST(BitUtils, findAndClearLSB64_2) {
|
||||
TEST(BitUtils, findAndClearMSB32_1) {
|
||||
// test that it can find every single-bit case
|
||||
for (unsigned int i = 0; i < 32; i++) {
|
||||
u32 input = 1 << i;
|
||||
u32 input = 1U << i;
|
||||
u32 idx = findAndClearMSB_32(&input);
|
||||
EXPECT_EQ(i, idx);
|
||||
EXPECT_EQ(0U, input);
|
||||
|
@ -46,7 +46,7 @@ UNUSED
|
||||
static
|
||||
void mmbit_display(const u8 *bits, u32 total_bits) {
|
||||
for (u32 i = 0; i < mmbit_size(total_bits); i += 8) {
|
||||
printf("block %d:", i / 8);
|
||||
printf("block %u:", i / 8);
|
||||
for (s32 j = 7; j >= 0; j--) {
|
||||
u8 a = (*(bits + i + j));
|
||||
printf(" %02x", a);
|
||||
@ -72,7 +72,7 @@ UNUSED
|
||||
static
|
||||
void mmbit_display_comp(const u8 *bits, u32 comp_size) {
|
||||
for (u32 i = 0; i < comp_size; i += 8) {
|
||||
printf("block %d:", i / 8);
|
||||
printf("block %u:", i / 8);
|
||||
for (s32 j = 7; j >= 0; j--) {
|
||||
u8 a = (*(bits + i + j));
|
||||
printf(" %02x", a);
|
||||
|
@ -245,7 +245,7 @@ TEST(pqueue, queue1) {
|
||||
u32 in[] = {1, 2, 3, 4, 5, 6, 7, 8};
|
||||
u32 expected[] = {4, 5, 6, 7, 8, 3, 2, 1};
|
||||
u32 temp[ARRAY_LENGTH(in)];
|
||||
u32 output[ARRAY_LENGTH(in)];
|
||||
u32 output[ARRAY_LENGTH(in)] = {0};
|
||||
|
||||
u32 queue_size = 0;
|
||||
u32 i = 0, o = 0;
|
||||
@ -275,7 +275,7 @@ TEST(pqueue, queue2) {
|
||||
u32 in[] = {8, 7, 6, 5, 4, 3, 2, 1};
|
||||
u32 expected[] = {8, 7, 6, 5, 4, 3, 2, 1};
|
||||
u32 temp[ARRAY_LENGTH(in)];
|
||||
u32 output[ARRAY_LENGTH(in)];
|
||||
u32 output[ARRAY_LENGTH(in)] = {0};
|
||||
|
||||
u32 queue_size = 0;
|
||||
u32 i = 0, o = 0;
|
||||
@ -301,7 +301,7 @@ TEST(pqueue, queue3) {
|
||||
u32 in[] = {1, 8, 2, 7, 3, 6, 4, 5};
|
||||
u32 expected[] = {8, 7, 6, 4, 5, 3, 2, 1};
|
||||
u32 temp[ARRAY_LENGTH(in)];
|
||||
u32 output[ARRAY_LENGTH(in)];
|
||||
u32 output[ARRAY_LENGTH(in)] = {0};
|
||||
|
||||
u32 queue_size = 0;
|
||||
u32 i = 0, o = 0;
|
||||
|
@ -508,7 +508,7 @@ TEST(SuperVectorUtilsTest,Movemask256c){
|
||||
u8 vec2[32] = {0};
|
||||
u32 r = rand() % 100 + 1;
|
||||
for(int i=0; i<32; i++) {
|
||||
if (r & (1 << i)) {
|
||||
if (r & (1U << i)) {
|
||||
vec[i] = 0xff;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user