blob: 524e41286034b05f4080fe4fbceb9d506fe8ee97 [file] [log] [blame]
Jeff Thompsonef2d5a42013-08-22 19:09:24 -07001# /* 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#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070014# ifndef NDNBOOST_PREPROCESSOR_ARITHMETIC_DETAIL_DIV_BASE_HPP
15# define NDNBOOST_PREPROCESSOR_ARITHMETIC_DETAIL_DIV_BASE_HPP
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070016#
17# include <ndnboost/preprocessor/arithmetic/inc.hpp>
18# include <ndnboost/preprocessor/arithmetic/sub.hpp>
19# include <ndnboost/preprocessor/comparison/less_equal.hpp>
20# include <ndnboost/preprocessor/config/config.hpp>
21# include <ndnboost/preprocessor/control/while.hpp>
22# include <ndnboost/preprocessor/tuple/elem.hpp>
23# include <ndnboost/preprocessor/tuple/rem.hpp>
24#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070025# /* NDNBOOST_PP_DIV_BASE */
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070026#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070027# if ~NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_EDG()
28# define NDNBOOST_PP_DIV_BASE(x, y) NDNBOOST_PP_WHILE(NDNBOOST_PP_DIV_BASE_P, NDNBOOST_PP_DIV_BASE_O, (0, x, y))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070029# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070030# define NDNBOOST_PP_DIV_BASE(x, y) NDNBOOST_PP_DIV_BASE_I(x, y)
31# define NDNBOOST_PP_DIV_BASE_I(x, y) NDNBOOST_PP_WHILE(NDNBOOST_PP_DIV_BASE_P, NDNBOOST_PP_DIV_BASE_O, (0, x, y))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070032# endif
33#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070034# if NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_STRICT()
35# define NDNBOOST_PP_DIV_BASE_P(d, rxy) NDNBOOST_PP_DIV_BASE_P_IM(d, NDNBOOST_PP_TUPLE_REM_3 rxy)
36# define NDNBOOST_PP_DIV_BASE_P_IM(d, im) NDNBOOST_PP_DIV_BASE_P_I(d, im)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070037# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070038# define NDNBOOST_PP_DIV_BASE_P(d, rxy) NDNBOOST_PP_DIV_BASE_P_I(d, NDNBOOST_PP_TUPLE_ELEM(3, 0, rxy), NDNBOOST_PP_TUPLE_ELEM(3, 1, rxy), NDNBOOST_PP_TUPLE_ELEM(3, 2, rxy))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070039# endif
40#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070041# define NDNBOOST_PP_DIV_BASE_P_I(d, r, x, y) NDNBOOST_PP_LESS_EQUAL_D(d, y, x)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070042#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070043# if NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_STRICT()
44# define NDNBOOST_PP_DIV_BASE_O(d, rxy) NDNBOOST_PP_DIV_BASE_O_IM(d, NDNBOOST_PP_TUPLE_REM_3 rxy)
45# define NDNBOOST_PP_DIV_BASE_O_IM(d, im) NDNBOOST_PP_DIV_BASE_O_I(d, im)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070046# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070047# define NDNBOOST_PP_DIV_BASE_O(d, rxy) NDNBOOST_PP_DIV_BASE_O_I(d, NDNBOOST_PP_TUPLE_ELEM(3, 0, rxy), NDNBOOST_PP_TUPLE_ELEM(3, 1, rxy), NDNBOOST_PP_TUPLE_ELEM(3, 2, rxy))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070048# endif
49#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070050# define NDNBOOST_PP_DIV_BASE_O_I(d, r, x, y) (NDNBOOST_PP_INC(r), NDNBOOST_PP_SUB_D(d, x, y), y)
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070051#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070052# /* NDNBOOST_PP_DIV_BASE_D */
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070053#
Jeff Thompson3d613fd2013-10-15 15:39:04 -070054# if ~NDNBOOST_PP_CONFIG_FLAGS() & NDNBOOST_PP_CONFIG_EDG()
55# define NDNBOOST_PP_DIV_BASE_D(d, x, y) NDNBOOST_PP_WHILE_ ## d(NDNBOOST_PP_DIV_BASE_P, NDNBOOST_PP_DIV_BASE_O, (0, x, y))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070056# else
Jeff Thompson3d613fd2013-10-15 15:39:04 -070057# define NDNBOOST_PP_DIV_BASE_D(d, x, y) NDNBOOST_PP_DIV_BASE_D_I(d, x, y)
58# define NDNBOOST_PP_DIV_BASE_D_I(d, x, y) NDNBOOST_PP_WHILE_ ## d(NDNBOOST_PP_DIV_BASE_P, NDNBOOST_PP_DIV_BASE_O, (0, x, y))
Jeff Thompsonef2d5a42013-08-22 19:09:24 -070059# endif
60#
61# endif