mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
fdr_confirm: clean up use of flags
This commit is contained in:
parent
c878d5ec66
commit
06bafae81d
@ -42,9 +42,11 @@ u32 mul_hash_64(u64a lv, u64a andmsk, u64a mult, u32 nBits) {
|
|||||||
#define CONF_TYPE u64a
|
#define CONF_TYPE u64a
|
||||||
#define CONF_HASH_CALL mul_hash_64
|
#define CONF_HASH_CALL mul_hash_64
|
||||||
|
|
||||||
typedef enum LitInfoFlags {
|
/**
|
||||||
NoRepeat = 2,
|
* \brief Flag indicating this literal doesn't need to be delivered more than
|
||||||
} LitInfoFlags;
|
* once, used in LitInfo::flags.
|
||||||
|
*/
|
||||||
|
#define FDR_LIT_FLAG_NOREPEAT 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Structure describing a literal, linked to by FDRConfirm.
|
* \brief Structure describing a literal, linked to by FDRConfirm.
|
||||||
@ -58,11 +60,12 @@ struct LitInfo {
|
|||||||
hwlm_group_t groups;
|
hwlm_group_t groups;
|
||||||
u32 id; // literal ID as passed in
|
u32 id; // literal ID as passed in
|
||||||
u8 size;
|
u8 size;
|
||||||
u8 flags; /* LitInfoFlags */
|
u8 flags; //!< bitfield of flags from FDR_LIT_FLAG_* above.
|
||||||
u8 next;
|
u8 next;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FDRC_FLAG_NO_CONFIRM 1
|
#define FDRC_FLAG_NO_CONFIRM 1
|
||||||
|
#define FDRC_FLAG_NOREPEAT 2
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief FDR confirm header.
|
* \brief FDR confirm header.
|
||||||
|
@ -94,7 +94,7 @@ void fillLitInfo(const vector<hwlmLiteral> &lits, vector<LitInfo> &tmpLitInfo,
|
|||||||
info.id = lit.id;
|
info.id = lit.id;
|
||||||
u8 flags = 0;
|
u8 flags = 0;
|
||||||
if (lit.noruns) {
|
if (lit.noruns) {
|
||||||
flags |= NoRepeat;
|
flags |= FDR_LIT_FLAG_NOREPEAT;
|
||||||
}
|
}
|
||||||
info.flags = flags;
|
info.flags = flags;
|
||||||
info.size = verify_u8(max(lit.msk.size(), lit.s.size()));
|
info.size = verify_u8(max(lit.msk.size(), lit.s.size()));
|
||||||
@ -170,7 +170,7 @@ bytecode_ptr<FDRConfirm> getFDRConfirm(const vector<hwlmLiteral> &lits,
|
|||||||
if (!make_confirm) {
|
if (!make_confirm) {
|
||||||
flags = FDRC_FLAG_NO_CONFIRM;
|
flags = FDRC_FLAG_NO_CONFIRM;
|
||||||
if (lits[0].noruns) {
|
if (lits[0].noruns) {
|
||||||
flags |= NoRepeat; // messy - need to clean this up later as flags is sorta kinda obsoleted
|
flags |= FDRC_FLAG_NOREPEAT; // messy - need to clean this up later as flags is sorta kinda obsoleted
|
||||||
}
|
}
|
||||||
mult = 0;
|
mult = 0;
|
||||||
soleLitSize = lits[0].s.size() - 1;
|
soleLitSize = lits[0].s.size() - 1;
|
||||||
|
@ -64,7 +64,7 @@ void confWithBit(const struct FDRConfirm *fdrc, const struct FDR_Runtime_Args *a
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*last_match == li->id) && (li->flags & NoRepeat)) {
|
if ((*last_match == li->id) && (li->flags & FDR_LIT_FLAG_NOREPEAT)) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ void confWithBit1(const struct FDRConfirm *fdrc,
|
|||||||
} else {
|
} else {
|
||||||
u32 id = fdrc->nBitsOrSoleID;
|
u32 id = fdrc->nBitsOrSoleID;
|
||||||
|
|
||||||
if ((*last_match == id) && (fdrc->flags & NoRepeat)) {
|
if ((*last_match == id) && (fdrc->flags & FDRC_FLAG_NOREPEAT)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*last_match = id;
|
*last_match = id;
|
||||||
@ -139,7 +139,7 @@ void confWithBitMany(const struct FDRConfirm *fdrc,
|
|||||||
const u32 id = fdrc->nBitsOrSoleID;
|
const u32 id = fdrc->nBitsOrSoleID;
|
||||||
const u32 len = fdrc->soleLitSize;
|
const u32 len = fdrc->soleLitSize;
|
||||||
|
|
||||||
if ((*last_match == id) && (fdrc->flags & NoRepeat)) {
|
if ((*last_match == id) && (fdrc->flags & FDRC_FLAG_NOREPEAT)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user