1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2024-11-08 08:54:34 +05:30

opt_int_div.h: make comments more descriptive

This commit is contained in:
Intel A80486DX2-66 2024-04-22 00:22:49 +03:00
parent 5049a3977e
commit 98f020413f
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -22,19 +22,20 @@
#define OPT_INT_DIV_TEST(b) \
/* check if b is a power of 2 */ \
/* */ \
/* formula: ( X & (X - 1) ) == 0 */ \
/* condition: ( X & (X - 1) ) == 0 */ \
((b) & ((b) - 1)) == 0
// the main macro
#define OPT_INT_DIV(a, b) \
( /* beginning */ \
/* check for equality of a and b */ \
/* check for equality of abs(a) and abs(b) */ \
INT_ABS((a)) == INT_ABS((b)) ? \
/* the result is +/-1 */ \
(INT_DIV_NEG_RESULT_SIGN(a, b) ? -1 : 1) : ( \
\
/* check if abs(a) < abs(b) */ \
INT_ABS((a)) < INT_ABS((b)) ? \
/* if abs(a) < abs(b), then the result is less than 1 (i.e., 0) */\
0 : ( \
\
OPT_INT_DIV_TEST((b)) ? \