Hideaki Tai / msgpack-embedded

Dependents:   hello_message_pack

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mul.hpp Source File

mul.hpp

00001 # /* Copyright (C) 2001
00002 #  * Housemarque Oy
00003 #  * http://www.housemarque.com
00004 #  *
00005 #  * Distributed under the Boost Software License, Version 1.0. (See
00006 #  * accompanying file LICENSE_1_0.txt or copy at
00007 #  * http://www.boost.org/LICENSE_1_0.txt)
00008 #  */
00009 #
00010 # /* Revised by Paul Mensonides (2002) */
00011 #
00012 # /* See http://www.boost.org for most recent version. */
00013 #
00014 # ifndef MSGPACK_PREPROCESSOR_ARITHMETIC_MUL_HPP
00015 # define MSGPACK_PREPROCESSOR_ARITHMETIC_MUL_HPP
00016 #
00017 # include <msgpack/preprocessor/arithmetic/add.hpp>
00018 # include <msgpack/preprocessor/arithmetic/dec.hpp>
00019 # include <msgpack/preprocessor/config/config.hpp>
00020 # include <msgpack/preprocessor/control/while.hpp>
00021 # include <msgpack/preprocessor/tuple/elem.hpp>
00022 # include <msgpack/preprocessor/tuple/rem.hpp>
00023 #
00024 # /* MSGPACK_PP_MUL */
00025 #
00026 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
00027 #    define MSGPACK_PP_MUL(x, y) MSGPACK_PP_TUPLE_ELEM(3, 0, MSGPACK_PP_WHILE(MSGPACK_PP_MUL_P, MSGPACK_PP_MUL_O, (0, x, y)))
00028 # else
00029 #    define MSGPACK_PP_MUL(x, y) MSGPACK_PP_MUL_I(x, y)
00030 #    define MSGPACK_PP_MUL_I(x, y) MSGPACK_PP_TUPLE_ELEM(3, 0, MSGPACK_PP_WHILE(MSGPACK_PP_MUL_P, MSGPACK_PP_MUL_O, (0, x, y)))
00031 # endif
00032 #
00033 # define MSGPACK_PP_MUL_P(d, rxy) MSGPACK_PP_TUPLE_ELEM(3, 2, rxy)
00034 #
00035 # if MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_STRICT()
00036 #    define MSGPACK_PP_MUL_O(d, rxy) MSGPACK_PP_MUL_O_IM(d, MSGPACK_PP_TUPLE_REM_3 rxy)
00037 #    define MSGPACK_PP_MUL_O_IM(d, im) MSGPACK_PP_MUL_O_I(d, im)
00038 # else
00039 #    define MSGPACK_PP_MUL_O(d, rxy) MSGPACK_PP_MUL_O_I(d, MSGPACK_PP_TUPLE_ELEM(3, 0, rxy), MSGPACK_PP_TUPLE_ELEM(3, 1, rxy), MSGPACK_PP_TUPLE_ELEM(3, 2, rxy))
00040 # endif
00041 #
00042 # define MSGPACK_PP_MUL_O_I(d, r, x, y) (MSGPACK_PP_ADD_D(d, r, x), x, MSGPACK_PP_DEC(y))
00043 #
00044 # /* MSGPACK_PP_MUL_D */
00045 #
00046 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
00047 #    define MSGPACK_PP_MUL_D(d, x, y) MSGPACK_PP_TUPLE_ELEM(3, 0, MSGPACK_PP_WHILE_ ## d(MSGPACK_PP_MUL_P, MSGPACK_PP_MUL_O, (0, x, y)))
00048 # else
00049 #    define MSGPACK_PP_MUL_D(d, x, y) MSGPACK_PP_MUL_D_I(d, x, y)
00050 #    define MSGPACK_PP_MUL_D_I(d, x, y) MSGPACK_PP_TUPLE_ELEM(3, 0, MSGPACK_PP_WHILE_ ## d(MSGPACK_PP_MUL_P, MSGPACK_PP_MUL_O, (0, x, y)))
00051 # endif
00052 #
00053 # endif