File indexing completed on 2025-01-18 09:48:07
0001 #
0002
0003
0004
0005
0006
0007
0008
0009 #
0010 #
0011 #
0012 #
0013 #
0014 #
0015 # ifndef BOOST_PREPROCESSOR_ARITHMETIC_MUL_HPP
0016 # define BOOST_PREPROCESSOR_ARITHMETIC_MUL_HPP
0017 #
0018 # include <boost/preprocessor/config/config.hpp>
0019 #
0020 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0021 #
0022 # include <boost/preprocessor/arithmetic/add.hpp>
0023 # include <boost/preprocessor/arithmetic/dec.hpp>
0024 # include <boost/preprocessor/control/while.hpp>
0025 # include <boost/preprocessor/tuple/elem.hpp>
0026 # include <boost/preprocessor/tuple/rem.hpp>
0027 #
0028 #
0029 #
0030 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
0031 # define BOOST_PP_MUL(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
0032 # else
0033 # define BOOST_PP_MUL(x, y) BOOST_PP_MUL_I(x, y)
0034 # define BOOST_PP_MUL_I(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
0035 # endif
0036 #
0037 # define BOOST_PP_MUL_P(d, rxy) BOOST_PP_TUPLE_ELEM(3, 2, rxy)
0038 #
0039 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0040 # define BOOST_PP_MUL_O(d, rxy) BOOST_PP_MUL_O_IM(d, BOOST_PP_TUPLE_REM_3 rxy)
0041 # define BOOST_PP_MUL_O_IM(d, im) BOOST_PP_MUL_O_I(d, im)
0042 # else
0043 # define BOOST_PP_MUL_O(d, rxy) BOOST_PP_MUL_O_I(d, BOOST_PP_TUPLE_ELEM(3, 0, rxy), BOOST_PP_TUPLE_ELEM(3, 1, rxy), BOOST_PP_TUPLE_ELEM(3, 2, rxy))
0044 # endif
0045 #
0046 # define BOOST_PP_MUL_O_I(d, r, x, y) (BOOST_PP_ADD_D(d, r, x), x, BOOST_PP_DEC(y))
0047 #
0048 #
0049 #
0050 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
0051 # define BOOST_PP_MUL_D(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE_ ## d(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
0052 # else
0053 # define BOOST_PP_MUL_D(d, x, y) BOOST_PP_MUL_D_I(d, x, y)
0054 # define BOOST_PP_MUL_D_I(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE_ ## d(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
0055 # endif
0056 #
0057 # else
0058 #
0059 # include <boost/preprocessor/arithmetic/add.hpp>
0060 # include <boost/preprocessor/arithmetic/dec.hpp>
0061 # include <boost/preprocessor/control/iif.hpp>
0062 # include <boost/preprocessor/control/while.hpp>
0063 # include <boost/preprocessor/facilities/identity.hpp>
0064 # include <boost/preprocessor/logical/bitand.hpp>
0065 # include <boost/preprocessor/logical/bool.hpp>
0066 # include <boost/preprocessor/logical/compl.hpp>
0067 # include <boost/preprocessor/tuple/elem.hpp>
0068 # include <boost/preprocessor/tuple/rem.hpp>
0069 # include <boost/preprocessor/arithmetic/detail/is_minimum_number.hpp>
0070 # include <boost/preprocessor/arithmetic/detail/is_maximum_number.hpp>
0071 # include <boost/preprocessor/arithmetic/detail/is_1_number.hpp>
0072 #
0073 #
0074 #
0075 # define BOOST_PP_MUL(x, y) BOOST_PP_IIF(BOOST_PP_DETAIL_IS_MINIMUM_NUMBER(x),BOOST_PP_IDENTITY_N(x,2),BOOST_PP_MUL_CHECK_1X)(x,y)
0076 #
0077 # define BOOST_PP_MUL_CHECK_1X(x, y) BOOST_PP_IIF(BOOST_PP_DETAIL_IS_1_NUMBER(x),BOOST_PP_IDENTITY_N(y,2),BOOST_PP_MUL_DO)(x,y)
0078 #
0079 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
0080 # define BOOST_PP_MUL_DO(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
0081 # else
0082 # define BOOST_PP_MUL_DO(x, y) BOOST_PP_MUL_I(x, y)
0083 # define BOOST_PP_MUL_I(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
0084 # endif
0085 #
0086 # define BOOST_PP_MUL_P(d, rxy) BOOST_PP_BITAND(BOOST_PP_BOOL(BOOST_PP_TUPLE_ELEM(3, 2, rxy)),BOOST_PP_COMPL(BOOST_PP_DETAIL_IS_MAXIMUM_NUMBER(BOOST_PP_TUPLE_ELEM(3, 0, rxy))))
0087 #
0088 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
0089 # define BOOST_PP_MUL_O(d, rxy) BOOST_PP_MUL_O_IM(d, BOOST_PP_TUPLE_REM_3 rxy)
0090 # define BOOST_PP_MUL_O_IM(d, im) BOOST_PP_MUL_O_I(d, im)
0091 # else
0092 # define BOOST_PP_MUL_O(d, rxy) BOOST_PP_MUL_O_I(d, BOOST_PP_TUPLE_ELEM(3, 0, rxy), BOOST_PP_TUPLE_ELEM(3, 1, rxy), BOOST_PP_TUPLE_ELEM(3, 2, rxy))
0093 # endif
0094 #
0095 # define BOOST_PP_MUL_O_I(d, r, x, y) (BOOST_PP_ADD_D(d, r, x), x, BOOST_PP_DEC(y))
0096 #
0097 #
0098 #
0099 # define BOOST_PP_MUL_D(d, x, y) BOOST_PP_IIF(BOOST_PP_DETAIL_IS_MINIMUM_NUMBER(x),BOOST_PP_IDENTITY_N(x,3),BOOST_PP_MUL_CHECK_1X_D)(d,x,y)
0100 #
0101 # define BOOST_PP_MUL_CHECK_1X_D(d, x, y) BOOST_PP_IIF(BOOST_PP_DETAIL_IS_1_NUMBER(x),BOOST_PP_IDENTITY_N(y,3),BOOST_PP_MUL_DO_D)(d,x,y)
0102 #
0103 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
0104 # define BOOST_PP_MUL_DO_D(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE_ ## d(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
0105 # else
0106 # define BOOST_PP_MUL_DO_D(d, x, y) BOOST_PP_MUL_D_I(d, x, y)
0107 # define BOOST_PP_MUL_D_I(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_WHILE_ ## d(BOOST_PP_MUL_P, BOOST_PP_MUL_O, (0, x, y)))
0108 # endif
0109 #
0110 # endif
0111 #
0112 # endif