Imported Upstream version 0.8~alpha1
[platform/upstream/syncevolution.git] / src / boost / preprocessor / arithmetic / mul.hpp
1 # /* Copyright (C) 2001
2 #  * Housemarque Oy
3 #  * http://www.housemarque.com
4 #  *
5 #  * Distributed under the Boost Software License, Version 1.0. (See
6 #  * accompanying file LICENSE_1_0.txt or copy at
7 #  * http://www.boost.org/LICENSE_1_0.txt)
8 #  */
9 #
10 # /* Revised by Paul Mensonides (2002) */
11 #
12 # /* See http://www.boost.org for most recent version. */
13 #
14 # ifndef BOOST_PREPROCESSOR_ARITHMETIC_MUL_HPP
15 # define BOOST_PREPROCESSOR_ARITHMETIC_MUL_HPP
16 #
17 # include <boost/preprocessor/arithmetic/add.hpp>
18 # include <boost/preprocessor/arithmetic/dec.hpp>
19 # include <boost/preprocessor/config/config.hpp>
20 # include <boost/preprocessor/control/while.hpp>
21 # include <boost/preprocessor/tuple/elem.hpp>
22 # include <boost/preprocessor/tuple/rem.hpp>
23 #
24 # /* BOOST_PP_MUL */
25 #
26 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
27 #    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)))
28 # else
29 #    define BOOST_PP_MUL(x, y) BOOST_PP_MUL_I(x, y)
30 #    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)))
31 # endif
32 #
33 # define BOOST_PP_MUL_P(d, rxy) BOOST_PP_TUPLE_ELEM(3, 2, rxy)
34 #
35 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
36 #    define BOOST_PP_MUL_O(d, rxy) BOOST_PP_MUL_O_IM(d, BOOST_PP_TUPLE_REM_3 rxy)
37 #    define BOOST_PP_MUL_O_IM(d, im) BOOST_PP_MUL_O_I(d, im)
38 # else
39 #    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))
40 # endif
41 #
42 # define BOOST_PP_MUL_O_I(d, r, x, y) (BOOST_PP_ADD_D(d, r, x), x, BOOST_PP_DEC(y))
43 #
44 # /* BOOST_PP_MUL_D */
45 #
46 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
47 #    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)))
48 # else
49 #    define BOOST_PP_MUL_D(d, x, y) BOOST_PP_MUL_D_I(d, x, y)
50 #    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)))
51 # endif
52 #
53 # endif