acl: introduce a macro for bitmask conversion
[dpdk.git] / lib / librte_acl / rte_acl.h
index 8d9bbe5..bd8f892 100644 (file)
@@ -122,6 +122,9 @@ enum {
 
 #define        RTE_ACL_INVALID_USERDATA        0
 
+#define        RTE_ACL_MASKLEN_TO_BITMASK(v, s)        \
+((v) == 0 ? (v) : (typeof(v))((uint64_t)-1 << ((s) * CHAR_BIT - (v))))
+
 /**
  * Miscellaneous data for ACL rule.
  */