COMPARISON.H(3)

πŸ“¦
version 1.5.2 Β· 2 versions
, in ubuntu resolute, ubuntu stonking

πŸ’… include/Zycore/Comparison.h πŸ’…

okay bestie, welcome to the Library Functions Manual page for include/Zycore/Comparison.h β€” the Zycore header that's basically the friendship-matchmaker for your data types. it decides who's equal and who's bigger. no cap. 🫢


✨ NAME ✨

include/Zycore/Comparison.h


🌸 SYNOPSIS 🌸

#include <Zycore/Defines.h>
#include <Zycore/Types.h>

πŸŽ€ Macros πŸŽ€

here's the macro lineup, bestie:

  • #define ZYAN_DECLARE_EQUALITY_COMPARISON(name, type)
  • #define ZYAN_DECLARE_EQUALITY_COMPARISON_FOR_FIELD(name, type, field_name)
  • #define ZYAN_DECLARE_COMPARISON(name, type)
  • #define ZYAN_DECLARE_COMPARISON_FOR_FIELD(name, type, field_name)

🧚 Typedefs 🧚

two lil function-pointer icons, serving looks:

  • typedef ZyanBool(* ZyanEqualityComparison) (const void *left, const void *right)
  • typedef ZyanI32(* ZyanComparison) (const void *left, const void *right)

πŸ¦‹ Functions πŸ¦‹

the doxygen gremlins wrapped this one kind of unhinged, but here's the raw list verbatim so nothing gets lost:

ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON (ZyanEqualsPointer, void *const) ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON(ZyanEqualsBool
ZYAN_INLINE ZyanBool ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON (ZyanEqualsNumeric8, ZyanU8) ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON(ZyanEqualsNumeric16
ZYAN_INLINE ZyanBool ZYAN_INLINE ZyanU16 ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON (ZyanEqualsNumeric32, ZyanU32) ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON(ZyanEqualsNumeric64
ZYAN_INLINE ZyanBool ZYAN_INLINE ZyanU16 ZYAN_INLINE ZyanU64 ZYAN_INLINE ZYAN_DECLARE_COMPARISON (ZyanComparePointer, void *const) ZYAN_INLINE ZYAN_DECLARE_COMPARISON(ZyanCompareBool
ZYAN_INLINE ZyanBool ZYAN_INLINE ZyanU16 ZYAN_INLINE ZyanU64 ZYAN_INLINE ZyanBool ZYAN_INLINE ZYAN_DECLARE_COMPARISON (ZyanCompareNumeric8, ZyanU8) ZYAN_INLINE ZYAN_DECLARE_COMPARISON(ZyanCompareNumeric16
ZYAN_INLINE ZyanBool ZYAN_INLINE ZyanU16 ZYAN_INLINE ZyanU64 ZYAN_INLINE ZyanBool ZYAN_INLINE ZyanU16 ZYAN_INLINE ZYAN_DECLARE_COMPARISON (ZyanCompareNumeric32, ZyanU32) ZYAN_INLINE ZYAN_DECLARE_COMPARISON(ZyanCompareNumeric64

πŸ’– DETAILED DESCRIPTION πŸ’–

literally what it says on the tin: this defines the prototypes of general-purpose comparison functions. that's the whole vibe. πŸ’«


πŸŽ€ MACRO DEFINITION DOCUMENTATION πŸŽ€

πŸ“ #define ZYAN_DECLARE_COMPARISON( name, type)

Value:

ZyanI32 name(const type* left, const type* right) \
{ \
    ZYAN_ASSERT(left); \
    ZYAN_ASSERT(right); \
    \
    if (*left < *right) \
    { \
        return -1; \
    } \
    if (*left > *right) \
    { \
        return  1; \
    } \
    return 0; \
}

Declares a generic comparison function for an integral data-type. it's giving orderer-of-the-numbers energy. πŸ”₯

Parameters:

  • name β€” the name of the function.
  • type β€” the name of the integral data-type.

πŸ“ #define ZYAN_DECLARE_COMPARISON_FOR_FIELD( name, type, field_name)

Value:

ZyanI32 name(const type* left, const type* right) \
{ \
    ZYAN_ASSERT(left); \
    ZYAN_ASSERT(right); \
    \
    if (left->field_name < right->field_name) \
    { \
        return -1; \
    } \
    if (left->field_name > right->field_name) \
    { \
        return  1; \
    } \
    return 0; \
}

Declares a generic comparison function that compares a single integral data-type field of a struct. one field, main character energy, no side quests. πŸ‘‘

Parameters:

  • name β€” the name of the function.
  • type β€” the name of the integral data-type.
  • field_name β€” the name of the struct field.

πŸ“ #define ZYAN_DECLARE_EQUALITY_COMPARISON( name, type)

Value:

ZyanBool name(const type* left, const type* right) \
{ \
    ZYAN_ASSERT(left); \
    ZYAN_ASSERT(right); \
    \
    return (*left == *right) ? ZYAN_TRUE : ZYAN_FALSE; \
}

Declares a generic equality comparison function for an integral data-type. are they the same? iconic question. are they not? also valid. ✨

Parameters:

  • name β€” the name of the function.
  • type β€” the name of the integral data-type.

πŸ“ #define ZYAN_DECLARE_EQUALITY_COMPARISON_FOR_FIELD( name, type, field_name)

Value:

ZyanBool name(const type* left, const type* right) \
{ \
    ZYAN_ASSERT(left); \
    ZYAN_ASSERT(right); \
    \
    return (left->field_name == right->field_name) ? ZYAN_TRUE : ZYAN_FALSE; \
}

Declares a generic equality comparison function that compares a single integral data-type field of a struct. just the one field, bestie. it's committed. πŸ’œ

Parameters:

  • name β€” the name of the function.
  • type β€” the name of the integral data-type.
  • field_name β€” the name of the struct field.

πŸ¦‹ TYPEDEF DOCUMENTATION πŸ¦‹

🌈 typedef ZyanI32(* ZyanComparison) (const void *left, const void *right)

Defines the ZyanComparison function prototype.

Parameters:

  • left β€” a pointer to the first element.
  • right β€” a pointer to the second element.

Returns:

This function should return values in the following range: left == right -> result == 0 left < right -> result < 0 left > right -> result > 0

🌈 typedef ZyanBool(* ZyanEqualityComparison) (const void *left, const void *right)

Defines the ZyanEqualityComparison function prototype.

Parameters:

  • left β€” a pointer to the first element.
  • right β€” a pointer to the second element.

Returns:

This function should return ZYAN_TRUE if the left element equals the right one or ZYAN_FALSE, if not.


🌟 FUNCTION DOCUMENTATION 🌟

ngl the doxygen output below is kinda scrambled β€” the signatures got fused together and the descriptions got glued onto each other. I'm keeping it all exactly as it came, no edits, so nothing vanishes. πŸ’€

πŸ’« ZYAN_INLINE ZyanBool ZYAN_INLINE ZyanU16 ZYAN_INLINE ZyanU64 ZYAN_INLINE ZyanBool ZYAN_INLINE ZyanU16 ZYAN_INLINE ZYAN_DECLARE_COMPARISON (ZyanCompareNumeric32 , ZyanU32 )

Defines a default comparison function for 32-bit numeric values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns 0 if the left value equals the right one, -1 if the left value is less than the right one, or 1 if the left value is greater than the right one. Defines a default comparison function for 64-bit numeric values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns 0 if the left value equals the right one, -1 if the left value is less than the right one, or 1 if the left value is greater than the right one.

πŸ’« ZYAN_INLINE ZyanBool ZYAN_INLINE ZyanU16 ZYAN_INLINE ZyanU64 ZYAN_INLINE ZyanBool ZYAN_INLINE ZYAN_DECLARE_COMPARISON (ZyanCompareNumeric8 , ZyanU8 )

Defines a default comparison function for 8-bit numeric values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns 0 if the left value equals the right one, -1 if the left value is less than the right one, or 1 if the left value is greater than the right one. Defines a default comparison function for 16-bit numeric values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns 0 if the left value equals the right one, -1 if the left value is less than the right one, or 1 if the left value is greater than the right one.

πŸ’« ZYAN_INLINE ZyanBool ZYAN_INLINE ZyanU16 ZYAN_INLINE ZyanU64 ZYAN_INLINE ZYAN_DECLARE_COMPARISON (ZyanComparePointer , void * const )

Defines a default comparison function for pointer values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns 0 if the left value equals the right one, -1 if the left value is less than the right one, or 1 if the left value is greater than the right one. Defines a default comparison function for ZyanBool values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns 0 if the left value equals the right one, -1 if the left value is less than the right one, or 1 if the left value is greater than the right one.

πŸ’« ZYAN_INLINE ZyanBool ZYAN_INLINE ZyanU16 ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON (ZyanEqualsNumeric32 , ZyanU32 )

Defines a default equality comparison function for 32-bit numeric values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns ZYAN_TRUE if the left value equals the right one or ZYAN_FALSE, if not. Defines a default equality comparison function for 64-bit numeric values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns ZYAN_TRUE if the left value equals the right one or ZYAN_FALSE, if not.

πŸ’« ZYAN_INLINE ZyanBool ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON (ZyanEqualsNumeric8 , ZyanU8 )

Defines a default equality comparison function for 8-bit numeric values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns ZYAN_TRUE if the left value equals the right one or ZYAN_FALSE, if not. Defines a default equality comparison function for 16-bit numeric values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns ZYAN_TRUE if the left value equals the right one or ZYAN_FALSE, if not.

πŸ’« ZYAN_INLINE ZYAN_DECLARE_EQUALITY_COMPARISON (ZyanEqualsPointer , void * const )

Defines a default equality comparison function for pointer values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns ZYAN_TRUE if the left value equals the right one or ZYAN_FALSE, if not. Defines a default equality comparison function for ZyanBool values.

Parameters:

  • left β€” a pointer to the first value.
  • right β€” a pointer to the second value.

Returns:

Returns ZYAN_TRUE if the left value equals the right one or ZYAN_FALSE, if not.


πŸ‘‘ AUTHOR πŸ‘‘

Generated automatically by Doxygen for Zycore from the source code.


okay that's the whole page bestie, you ate. πŸŽ€βœ¨ this was Zycore, Version 1.5.2.0 β€” so when you're out here comparing things, remember who wrote you a whole manual about it. include/Zy...omparison.h(3), signing off πŸ’…πŸ«Ά

πŸ“¦ where this page comes from