diff --git a/mdb.c b/mdb.c index 4c8cb226..9b7e452d 100644 --- a/mdb.c +++ b/mdb.c @@ -5136,7 +5136,11 @@ mdb_env_close(MDB_env *env) * | 1, a > b * \ */ -#define mdbx_cmp2int(a, b) (((a) > (b)) - ((b) > (a))) +#if 1 +# define mdbx_cmp2int(a, b) (((b) > (a)) ? -1 : (a) > (b)) +#else +# define mdbx_cmp2int(a, b) (((a) > (b)) - ((b) > (a))) +#endif /** Compare two items pointing at aligned unsigned int's. */ static int __hot diff --git a/midl.c b/midl.c index 5156d7a1..8fae4693 100644 --- a/midl.c +++ b/midl.c @@ -28,7 +28,6 @@ /** @defgroup idls ID List Management * @{ */ -#define CMP(x,y) ( (x) < (y) ? -1 : (x) > (y) ) static unsigned __hot mdb_midl_search( MDB_IDL ids, MDB_ID id ) @@ -46,7 +45,7 @@ mdb_midl_search( MDB_IDL ids, MDB_ID id ) while( 0 < n ) { unsigned pivot = n >> 1; cursor = base + pivot + 1; - val = CMP( ids[cursor], id ); + val = mdbx_cmp2int( ids[cursor], id ); if( val < 0 ) { n = pivot; @@ -295,7 +294,7 @@ mdb_mid2l_search( MDB_ID2L ids, MDB_ID id ) while( 0 < n ) { unsigned pivot = n >> 1; cursor = base + pivot + 1; - val = CMP( id, ids[cursor].mid ); + val = mdbx_cmp2int( id, ids[cursor].mid ); if( val < 0 ) { n = pivot;