Add M_BOOL_OPLIST

This commit is contained in:
Patrick Pelissier committed 2020-05-30 23:45:29 +02:00
1 parent cc33079d43
commit d3823951b5
2 files changed
+15

No files matched your search

+5
View File
@@ -599,6 +599,7 @@ Example:
My type is:
* a C boolean: M\_BOOL\_OPLIST (M\_DEFAULT\_OPLIST also works)
* a C integer or a C float: M\_DEFAULT\_OPLIST (it can also be ommited),
* a pointer to something: M\_PTR\_OPLIST,
* a plain structure that can be init/copy/compare with memset/memcpy/memcmp: M\_POD\_OPLIST,
@@ -5519,6 +5520,10 @@ than a 'size\_t'.
Return the associated method to the given operator within the given oplist.
##### M\_BOOL\_OPLIST
Default oplist for C standard boolean.
##### M\_DEFAULT\_OPLIST
Default oplist for C standard types (int & float)
+10
View File
@@ -2276,6 +2276,8 @@ m_core_hash (const void *str, size_t length)
#define M_SUB_DEFAULT(a,b,c) ((a) = (b) - (c))
#define M_MUL_DEFAULT(a,b,c) ((a) = (b) * (c))
#define M_DIV_DEFAULT(a,b,c) ((a) = (b) / (c))
#define M_AND_DEFAULT(a,b,c) ((a) = (b) & (c))
#define M_OR_DEFAULT(a,b,c) ((a) = (b) | (c))
#define M_NO_EXT_ALGO(n,co,to)
#define M_INC_ALLOC_DEFAULT(n) (M_MAX(8, (n))*2)
@@ -2367,6 +2369,14 @@ m_core_hash (const void *str, size_t length)
HASH(M_HASH_DEFAULT), SWAP(M_SWAP_DEFAULT) )
#endif
/* Specialized oplist for a boolean.
* M_DEFAULT_OPLIST is nearly ok, except for ADD/SUB/MUL/DIV
* that generates warnings with boolean.
*/
#define M_BOOL_OPLIST \
M_OPEXTEND(M_DEFAULT_OPLIST, ADD(M_OR_DEFAULT), MUL(M_AND_DEFAULT), \
SUB(0), DIV(0))
/* Default oplist for standard types of pointers.
*/
#define M_PTR_OPLIST \