diff options
Diffstat (limited to 'include/kpl/identifier.h')
| -rw-r--r-- | include/kpl/identifier.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/kpl/identifier.h b/include/kpl/identifier.h index a30b4a7..9bb42b0 100644 --- a/include/kpl/identifier.h +++ b/include/kpl/identifier.h @@ -43,3 +43,16 @@ void kpl_identifier_decode(kpl_identifier *identifier, char c_string[KPL_IDENTIF * 0 - equal, negative - left < right, positive - left > right */ int32_t kpl_identifier_compare(const kpl_identifier *identifier_left, const kpl_identifier *identifier_right); + +/* + * Check if two identifiers are equal + * Faster then comparing when equality check is needed + */ +inline bool kpl_identifier_equal(const kpl_identifier *identifier_a, const kpl_identifier *identifier_b) { + for (int32_t part_index = 0; part_index < KPL_IDENTIFIER_PARTS; part_index++) + if (!identifier_a->parts[part_index] && !identifier_b->parts[part_index]) + break; + else if (identifier_a->parts[part_index] != identifier_b->parts[part_index]) + return false; + return true; +} |
