]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
fdr_confirm: clean up use of flags
authorJustin Viiret <justin.viiret@intel.com>
Wed, 24 May 2017 00:29:28 +0000 (10:29 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Mon, 21 Aug 2017 00:39:00 +0000 (10:39 +1000)
src/fdr/fdr_confirm.h
src/fdr/fdr_confirm_compile.cpp
src/fdr/fdr_confirm_runtime.h

index 816e9fe6dad01fb4ee13a3f1949a3baccba96e65..ebf0669cf4ba5c94d687d9482653e90f1578ad63 100644 (file)
@@ -42,9 +42,11 @@ u32 mul_hash_64(u64a lv, u64a andmsk, u64a mult, u32 nBits) {
 #define CONF_TYPE u64a
 #define CONF_HASH_CALL mul_hash_64
 
-typedef enum LitInfoFlags {
-    NoRepeat = 2,
-} LitInfoFlags;
+/**
+ * \brief Flag indicating this literal doesn't need to be delivered more than
+ * once, used in LitInfo::flags.
+ */
+#define FDR_LIT_FLAG_NOREPEAT   2
 
 /**
  * \brief Structure describing a literal, linked to by FDRConfirm.
@@ -58,11 +60,12 @@ struct LitInfo {
     hwlm_group_t groups;
     u32 id; // literal ID as passed in
     u8 size;
-    u8 flags; /* LitInfoFlags */
+    u8 flags; //!< bitfield of flags from FDR_LIT_FLAG_* above.
     u8 next;
 };
 
 #define FDRC_FLAG_NO_CONFIRM 1
+#define FDRC_FLAG_NOREPEAT   2
 
 /**
  * \brief FDR confirm header.
index 2c8359389e938a1ccc0a7d34ab2459b5bbb3ce05..e9ec9dcf6a2a5beb0a1766ed5e49255050ca69ee 100644 (file)
@@ -94,7 +94,7 @@ void fillLitInfo(const vector<hwlmLiteral> &lits, vector<LitInfo> &tmpLitInfo,
         info.id = lit.id;
         u8 flags = 0;
         if (lit.noruns) {
-            flags |= NoRepeat;
+            flags |= FDR_LIT_FLAG_NOREPEAT;
         }
         info.flags = flags;
         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) {
         flags = FDRC_FLAG_NO_CONFIRM;
         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;
         soleLitSize = lits[0].s.size() - 1;
index ace54543125ac8c9b55e1f64b561637f65cc068d..ea644bfb694746a748d525e5f214088bcaf70362 100644 (file)
@@ -64,7 +64,7 @@ void confWithBit(const struct FDRConfirm *fdrc, const struct FDR_Runtime_Args *a
             goto out;
         }
 
-        if ((*last_match == li->id) && (li->flags & NoRepeat)) {
+        if ((*last_match == li->id) && (li->flags & FDR_LIT_FLAG_NOREPEAT)) {
             goto out;
         }
 
@@ -110,7 +110,7 @@ void confWithBit1(const struct FDRConfirm *fdrc,
     } else {
         u32 id = fdrc->nBitsOrSoleID;
 
-        if ((*last_match == id) && (fdrc->flags & NoRepeat)) {
+        if ((*last_match == id) && (fdrc->flags & FDRC_FLAG_NOREPEAT)) {
             return;
         }
         *last_match = id;
@@ -139,7 +139,7 @@ void confWithBitMany(const struct FDRConfirm *fdrc,
         const u32 id = fdrc->nBitsOrSoleID;
         const u32 len = fdrc->soleLitSize;
 
-        if ((*last_match == id) && (fdrc->flags & NoRepeat)) {
+        if ((*last_match == id) && (fdrc->flags & FDRC_FLAG_NOREPEAT)) {
             return;
         }