2 // Copyright (c) 2000-2002
3 // Joerg Walter, Mathias Koch
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)
9 // The authors gratefully acknowledge the support of
10 // GeNeSys mbH & Co. KG in producing this work.
13 #ifndef _BOOST_UBLAS_DUFF_
14 #define _BOOST_UBLAS_DUFF_
16 #define DD_SWITCH(n, d, r, expr) \
18 unsigned r = ((n) + (d) - 1) / (d); \
19 switch ((n) % (d)) { \
21 #define DD_CASE_I(i, expr) \
24 } while (-- (r) > 0); \
28 #define DD_1T(n, d, r, expr) \
30 #define DD_2T(n, d, r, expr) \
33 #define DD_3T(n, d, r, expr) \
36 #define DD_4T(n, d, r, expr) \
39 #define DD_5T(n, d, r, expr) \
42 #define DD_6T(n, d, r, expr) \
45 #define DD_7T(n, d, r, expr) \
48 #define DD_8T(n, d, r, expr) \
52 #define DD(n, d, r, expr) \
53 DD_SWITCH(n, d, r, expr) \
54 DD_##d##T(n, d, r, expr)