Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 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 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 14 | # ifndef NDNBOOST_PREPROCESSOR_ARITHMETIC_DETAIL_DIV_BASE_HPP |
| 15 | # define NDNBOOST_PREPROCESSOR_ARITHMETIC_DETAIL_DIV_BASE_HPP |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 16 | # |
| 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 Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 25 | # /* NDNBOOST_PP_DIV_BASE */ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 26 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 27 | # 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 Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 29 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 30 | # 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 Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 32 | # endif |
| 33 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 34 | # 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 Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 37 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 38 | # 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 Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 39 | # endif |
| 40 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 41 | # define NDNBOOST_PP_DIV_BASE_P_I(d, r, x, y) NDNBOOST_PP_LESS_EQUAL_D(d, y, x) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 42 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 43 | # 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 Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 46 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 47 | # 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 Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 48 | # endif |
| 49 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 50 | # define NDNBOOST_PP_DIV_BASE_O_I(d, r, x, y) (NDNBOOST_PP_INC(r), NDNBOOST_PP_SUB_D(d, x, y), y) |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 51 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 52 | # /* NDNBOOST_PP_DIV_BASE_D */ |
Jeff Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 53 | # |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 54 | # 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 Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 56 | # else |
Jeff Thompson | 3d613fd | 2013-10-15 15:39:04 -0700 | [diff] [blame] | 57 | # 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 Thompson | ef2d5a4 | 2013-08-22 19:09:24 -0700 | [diff] [blame] | 59 | # endif |
| 60 | # |
| 61 | # endif |