Skip to content

Commit

Permalink
GHI #32 Add explicit and transaction feature check functions
Browse files Browse the repository at this point in the history
  • Loading branch information
doodspav committed May 10, 2024
1 parent a5561f6 commit 4b46e70
Showing 1 changed file with 178 additions and 0 deletions.
178 changes: 178 additions & 0 deletions include/patomic/types/feature_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,60 @@ patomic_feature_check_all(
);


/**
* @addtogroup feature_check
*
* @brief
* Checks if all of the operations in all the categories in a set of opcats
* are supported by the given explicit ops struct.
*
* @param opcats
* One or more patomic_opcat_t flags combined.
*
* @returns
* The input "opcats" value where each bit corresponding to a supported opcat
* has been cleared. An opcat is supported if all of its operations are
* supported. A return value of 0 means that everything requested is
* supported.
*
* @note
* Invalid bits in "opcats" which do not correspond to a patomic_opcat_t
* label are ignored and remain set in the return value.
*/
PATOMIC_EXPORT unsigned int
patomic_feature_check_all_explicit(
const patomic_ops_explicit_t *ops,
unsigned int opcats
);


/**
* @addtogroup feature_check
*
* @brief
* Checks if all of the operations in all the categories in a set of opcats
* are supported by the given transaction ops struct.
*
* @param opcats
* One or more patomic_opcat_t flags combined.
*
* @returns
* The input "opcats" value where each bit corresponding to a supported opcat
* has been cleared. An opcat is supported if all of its operations are
* supported. A return value of 0 means that everything requested is
* supported.
*
* @note
* Invalid bits in "opcats" which do not correspond to a patomic_opcat_t
* label are ignored and remain set in the return value.
*/
PATOMIC_EXPORT unsigned int
patomic_feature_check_all_transaction(
const patomic_ops_transaction_t *ops,
unsigned int opcats
);


/**
* @addtogroup feature_check
*
Expand Down Expand Up @@ -291,6 +345,60 @@ patomic_feature_check_any(
);


/**
* @addtogroup feature_check
*
* @brief
* Checks if any of the operations in all the categories in a set of opcats
* are supported by the given explicit ops struct.
*
* @param opcats
* One or more patomic_opcat_t flags combined.
*
* @returns
* The input "opcats" value where each bit corresponding to a supported opcat
* has been cleared. An opcat is supported if any of its operations are
* supported. A return value of 0 means that everything requested is
* supported.
*
* @note
* Invalid bits in "opcats" which do not correspond to a patomic_opcat_t
* label are ignored and remain set in the return value.
*/
PATOMIC_EXPORT unsigned int
patomic_feature_check_any_explicit(
const patomic_ops_explicit_t *ops,
unsigned int opcats
);


/**
* @addtogroup feature_check
*
* @brief
* Checks if any of the operations in all the categories in a set of opcats
* are supported by the given transaction ops struct.
*
* @param opcats
* One or more patomic_opcat_t flags combined.
*
* @returns
* The input "opcats" value where each bit corresponding to a supported opcat
* has been cleared. An opcat is supported if any of its operations are
* supported. A return value of 0 means that everything requested is
* supported.
*
* @note
* Invalid bits in "opcats" which do not correspond to a patomic_opcat_t
* label are ignored and remain set in the return value.
*/
PATOMIC_EXPORT unsigned int
patomic_feature_check_any_transaction(
const patomic_ops_transaction_t *ops,
unsigned int opcats
);


/**
* @addtogroup feature_check
*
Expand Down Expand Up @@ -326,4 +434,74 @@ patomic_feature_check_leaf(
);


/**
* @addtogroup feature_check
*
* @brief
* Checks if any operations in the set of opkinds in the category opcat are
* supported by the given explicit ops struct.
*
* @param opcat
* Any single patomic_opcat_t flag that has a single bit set.
*
* @param opkinds
* One or more patomic_opkind_t flags combined.
*
* @returns
* The input "opkinds" value interpreted according to "opcat" where each bit
* corresponding to a supported opkind has been cleared. A return value of 0
* means that everything requested is supported.
*
* @note
* Invalid bits in "opkinds" which do not correspond to a patomic_opkind_t
* label are ignored and remain set in the return value.
*
* @warning
* The "opcat" value MUST have exactly 1 bit set. This means that labels such
* as patomic_opcat_NONE and patomic_opcats_* are not allowed. This will
* always be asserted (even if NDEBUG is defined).
*/
PATOMIC_EXPORT unsigned int
patomic_feature_check_leaf_explicit(
const patomic_ops_explicit_t *ops,
patomic_opcat_t opcat,
unsigned int opkinds
);


/**
* @addtogroup feature_check
*
* @brief
* Checks if any operations in the set of opkinds in the category opcat are
* supported by the given transaction ops struct.
*
* @param opcat
* Any single patomic_opcat_t flag that has a single bit set.
*
* @param opkinds
* One or more patomic_opkind_t flags combined.
*
* @returns
* The input "opkinds" value interpreted according to "opcat" where each bit
* corresponding to a supported opkind has been cleared. A return value of 0
* means that everything requested is supported.
*
* @note
* Invalid bits in "opkinds" which do not correspond to a patomic_opkind_t
* label are ignored and remain set in the return value.
*
* @warning
* The "opcat" value MUST have exactly 1 bit set. This means that labels such
* as patomic_opcat_NONE and patomic_opcats_* are not allowed. This will
* always be asserted (even if NDEBUG is defined).
*/
PATOMIC_EXPORT unsigned int
patomic_feature_check_leaf_transaction(
const patomic_ops_transaction_t *ops,
patomic_opcat_t opcat,
unsigned int opkinds
);


#endif /* PATOMIC_FEATURE_CHECK_H */

0 comments on commit 4b46e70

Please sign in to comment.