diff options
author | José Valim <[email protected]> | 2016-02-15 11:00:26 +0100 |
---|---|---|
committer | José Valim <[email protected]> | 2016-02-15 11:01:09 +0100 |
commit | 345651148351c57b26347ee9a9b50e6e2732e79a (patch) | |
tree | 6385676c8f8a350c25b977a6aaaa01cd3b494be1 /erts/emulator/beam/erl_utils.h | |
parent | bc1e16e334afc8255b221e3ffbb6f7c54fb91a2d (diff) | |
download | otp-345651148351c57b26347ee9a9b50e6e2732e79a.tar.gz otp-345651148351c57b26347ee9a9b50e6e2732e79a.tar.bz2 otp-345651148351c57b26347ee9a9b50e6e2732e79a.zip |
Unify comparison macros in erl_utils.h
This removes the duplication in having both `cmp_eq`
and `CMP_EQ` and normalizes their name to uppercase.
Diffstat (limited to 'erts/emulator/beam/erl_utils.h')
-rw-r--r-- | erts/emulator/beam/erl_utils.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/erts/emulator/beam/erl_utils.h b/erts/emulator/beam/erl_utils.h index b8746f7edb..dd7b925bd3 100644 --- a/erts/emulator/beam/erl_utils.h +++ b/erts/emulator/beam/erl_utils.h @@ -169,14 +169,12 @@ Sint cmp(Eterm a, Eterm b); #define CMP_TERM(A,B) erts_cmp(A,B,1,0) #define CMP_EQ_ONLY(A,B) erts_cmp(A,B,0,1) -#define cmp_lt(a,b) (CMP((a),(b)) < 0) -#define cmp_le(a,b) (CMP((a),(b)) <= 0) -#define cmp_eq(a,b) (CMP_EQ_ONLY((a),(b)) == 0) -#define cmp_ne(a,b) (CMP_EQ_ONLY((a),(b)) != 0) -#define cmp_ge(a,b) (CMP((a),(b)) >= 0) -#define cmp_gt(a,b) (CMP((a),(b)) > 0) - -#define CMP_EQ(a,b) ((a) == (b) || cmp_eq((a),(b))) +#define CMP_LT(a,b) ((a) != (b) && CMP((a),(b)) < 0) +#define CMP_LE(a,b) ((a) == (b) || CMP((a),(b)) <= 0) +#define CMP_EQ(a,b) ((a) == (b) || CMP_EQ_ONLY((a),(b)) == 0) +#define CMP_NE(a,b) ((a) != (b) && CMP_EQ_ONLY((a),(b)) != 0) +#define CMP_GE(a,b) ((a) == (b) || CMP((a),(b)) >= 0) +#define CMP_GT(a,b) ((a) != (b) && CMP((a),(b)) > 0) #define CMP_EQ_ACTION(X,Y,Action) \ if ((X) != (Y)) { CMP_SPEC((X),(Y),!=,Action,1); } |