forked from boostorg/preprocessor
Added MOD and implemented ADD, SUB & MUL using WHILE reducing internal repetition
[SVN r12009]
This commit is contained in:
@ -34,16 +34,11 @@
|
||||
#endif
|
||||
|
||||
//! Expands to the quotient of X and Y.
|
||||
#define BOOST_PREPROCESSOR_DIV(X,Y)\
|
||||
BOOST_PREPROCESSOR_TUPLE_ELEM(3,0,BOOST_PREPROCESSOR_WHILE(BOOST_PREPROCESSOR_DIV_C,BOOST_PREPROCESSOR_DIV_F,(0,X,Y)))
|
||||
#define BOOST_PREPROCESSOR_DIV(X,Y) BOOST_PREPROCESSOR_DIV_I(0,X,Y)
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
#define BOOST_PREPROCESSOR_DIV_F(P)\
|
||||
( BOOST_PREPROCESSOR_INC(BOOST_PREPROCESSOR_TUPLE_ELEM(3,0,P))\
|
||||
, BOOST_PREPROCESSOR_SUB(BOOST_PREPROCESSOR_TUPLE_ELEM(3,1,P),BOOST_PREPROCESSOR_TUPLE_ELEM(3,2,P))\
|
||||
, BOOST_PREPROCESSOR_TUPLE_ELEM(3,2,P)\
|
||||
)
|
||||
#define BOOST_PREPROCESSOR_DIV_C(P)\
|
||||
BOOST_PREPROCESSOR_LESS_EQUAL(BOOST_PREPROCESSOR_TUPLE_ELEM(3,2,P),BOOST_PREPROCESSOR_TUPLE_ELEM(3,1,P))
|
||||
#define BOOST_PREPROCESSOR_DIV_I(I,X,Y) BOOST_PREPROCESSOR_TUPLE_ELEM(3,0,BOOST_PREPROCESSOR_WHILE##I(BOOST_PREPROCESSOR_DIV_C,BOOST_PREPROCESSOR_DIV_F,(0,X,Y)))
|
||||
#define BOOST_PREPROCESSOR_DIV_C(I,P) BOOST_PREPROCESSOR_LESS_EQUAL_I(I,BOOST_PREPROCESSOR_TUPLE_ELEM(3,2,P),BOOST_PREPROCESSOR_TUPLE_ELEM(3,1,P))
|
||||
#define BOOST_PREPROCESSOR_DIV_F(I,P) (BOOST_PREPROCESSOR_INC(BOOST_PREPROCESSOR_TUPLE_ELEM(3,0,P)),BOOST_PREPROCESSOR_SUB_I(I,BOOST_PREPROCESSOR_TUPLE_ELEM(3,1,P),BOOST_PREPROCESSOR_TUPLE_ELEM(3,2,P)),BOOST_PREPROCESSOR_TUPLE_ELEM(3,2,P))
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user