1 # /* Copyright (C) 2001
\r
3 # * http://www.housemarque.com
\r
5 # * Distributed under the Boost Software License, Version 1.0. (See
\r
6 # * accompanying file LICENSE_1_0.txt or copy at
\r
7 # * http://www.boost.org/LICENSE_1_0.txt)
\r
10 # /* Revised by Paul Mensonides (2002) */
\r
12 # /* See http://www.boost.org for most recent version. */
\r
14 # ifndef BOOST_PREPROCESSOR_ARITHMETIC_DETAIL_DIV_BASE_HPP
\r
15 # define BOOST_PREPROCESSOR_ARITHMETIC_DETAIL_DIV_BASE_HPP
\r
17 # include <boost/preprocessor/arithmetic/inc.hpp>
\r
18 # include <boost/preprocessor/arithmetic/sub.hpp>
\r
19 # include <boost/preprocessor/comparison/less_equal.hpp>
\r
20 # include <boost/preprocessor/config/config.hpp>
\r
21 # include <boost/preprocessor/control/while.hpp>
\r
22 # include <boost/preprocessor/tuple/elem.hpp>
\r
23 # include <boost/preprocessor/tuple/rem.hpp>
\r
25 # /* BOOST_PP_DIV_BASE */
\r
27 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
\r
28 # define BOOST_PP_DIV_BASE(x, y) BOOST_PP_WHILE(BOOST_PP_DIV_BASE_P, BOOST_PP_DIV_BASE_O, (0, x, y))
\r
30 # define BOOST_PP_DIV_BASE(x, y) BOOST_PP_DIV_BASE_I(x, y)
\r
31 # define BOOST_PP_DIV_BASE_I(x, y) BOOST_PP_WHILE(BOOST_PP_DIV_BASE_P, BOOST_PP_DIV_BASE_O, (0, x, y))
\r
34 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
\r
35 # define BOOST_PP_DIV_BASE_P(d, rxy) BOOST_PP_DIV_BASE_P_IM(d, BOOST_PP_TUPLE_REM_3 rxy)
\r
36 # define BOOST_PP_DIV_BASE_P_IM(d, im) BOOST_PP_DIV_BASE_P_I(d, im)
\r
38 # define BOOST_PP_DIV_BASE_P(d, rxy) BOOST_PP_DIV_BASE_P_I(d, BOOST_PP_TUPLE_ELEM(3, 0, rxy), BOOST_PP_TUPLE_ELEM(3, 1, rxy), BOOST_PP_TUPLE_ELEM(3, 2, rxy))
\r
41 # define BOOST_PP_DIV_BASE_P_I(d, r, x, y) BOOST_PP_LESS_EQUAL_D(d, y, x)
\r
43 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
\r
44 # define BOOST_PP_DIV_BASE_O(d, rxy) BOOST_PP_DIV_BASE_O_IM(d, BOOST_PP_TUPLE_REM_3 rxy)
\r
45 # define BOOST_PP_DIV_BASE_O_IM(d, im) BOOST_PP_DIV_BASE_O_I(d, im)
\r
47 # define BOOST_PP_DIV_BASE_O(d, rxy) BOOST_PP_DIV_BASE_O_I(d, BOOST_PP_TUPLE_ELEM(3, 0, rxy), BOOST_PP_TUPLE_ELEM(3, 1, rxy), BOOST_PP_TUPLE_ELEM(3, 2, rxy))
\r
50 # define BOOST_PP_DIV_BASE_O_I(d, r, x, y) (BOOST_PP_INC(r), BOOST_PP_SUB_D(d, x, y), y)
\r
52 # /* BOOST_PP_DIV_BASE_D */
\r
54 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
\r
55 # define BOOST_PP_DIV_BASE_D(d, x, y) BOOST_PP_WHILE_ ## d(BOOST_PP_DIV_BASE_P, BOOST_PP_DIV_BASE_O, (0, x, y))
\r
57 # define BOOST_PP_DIV_BASE_D(d, x, y) BOOST_PP_DIV_BASE_D_I(d, x, y)
\r
58 # define BOOST_PP_DIV_BASE_D_I(d, x, y) BOOST_PP_WHILE_ ## d(BOOST_PP_DIV_BASE_P, BOOST_PP_DIV_BASE_O, (0, x, y))
\r