1 # /* Copyright (C) 2001
3 # * http://www.housemarque.com
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)
10 # /* Revised by Paul Mensonides (2002) */
11 # /* Revised by Edward Diener (2020) */
13 # /* See http://www.boost.org for most recent version. */
15 # ifndef BOOST_PREPROCESSOR_ARITHMETIC_DIV_HPP
16 # define BOOST_PREPROCESSOR_ARITHMETIC_DIV_HPP
18 # include <boost/preprocessor/config/config.hpp>
20 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()
22 # include <boost/preprocessor/arithmetic/detail/div_base.hpp>
23 # include <boost/preprocessor/tuple/elem.hpp>
27 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
28 # define BOOST_PP_DIV(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE(x, y))
30 # define BOOST_PP_DIV(x, y) BOOST_PP_DIV_I(x, y)
31 # define BOOST_PP_DIV_I(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE(x, y))
34 # /* BOOST_PP_DIV_D */
36 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
37 # define BOOST_PP_DIV_D(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE_D(d, x, y))
39 # define BOOST_PP_DIV_D(d, x, y) BOOST_PP_DIV_D_I(d, x, y)
40 # define BOOST_PP_DIV_D_I(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE_D(d, x, y))
45 # include <boost/preprocessor/arithmetic/detail/div_base.hpp>
46 # include <boost/preprocessor/control/iif.hpp>
47 # include <boost/preprocessor/facilities/identity.hpp>
48 # include <boost/preprocessor/tuple/elem.hpp>
49 # include <boost/preprocessor/arithmetic/detail/is_1_number.hpp>
53 # define BOOST_PP_DIV(x, y) BOOST_PP_IIF(BOOST_PP_DETAIL_IS_1_NUMBER(y),BOOST_PP_IDENTITY_N(x,2),BOOST_PP_DIV_DO)(x,y)
55 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
56 # define BOOST_PP_DIV_DO(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE(x, y))
58 # define BOOST_PP_DIV_DO(x, y) BOOST_PP_DIV_I(x, y)
59 # define BOOST_PP_DIV_I(x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE(x, y))
62 # /* BOOST_PP_DIV_D */
64 # define BOOST_PP_DIV_D(d, x, y) BOOST_PP_IIF(BOOST_PP_DETAIL_IS_1_NUMBER(y),BOOST_PP_IDENTITY_N(x,3),BOOST_PP_DIV_DO_D)(d,x,y)
66 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
67 # define BOOST_PP_DIV_DO_D(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE_D(d, x, y))
69 # define BOOST_PP_DIV_DO_D(d, x, y) BOOST_PP_DIV_D_I(d, x, y)
70 # define BOOST_PP_DIV_D_I(d, x, y) BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_DIV_BASE_D(d, x, y))