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