Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:59

0001 //
0002 //  Copyright (c) 2000-2002
0003 //  Joerg Walter, Mathias Koch
0004 //
0005 //  Distributed under the Boost Software License, Version 1.0. (See
0006 //  accompanying file LICENSE_1_0.txt or copy at
0007 //  http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 //  The authors gratefully acknowledge the support of
0010 //  GeNeSys mbH & Co. KG in producing this work.
0011 //
0012 
0013 #ifndef _BOOST_UBLAS_DUFF_
0014 #define _BOOST_UBLAS_DUFF_
0015 
0016 #define DD_SWITCH(n, d, r, expr) \
0017     { \
0018         unsigned r = ((n) + (d) - 1) / (d); \
0019         switch ((n) % (d))  { \
0020         case 0: do { expr;
0021 #define DD_CASE_I(i, expr) \
0022         case (i): expr;
0023 #define DD_WHILE(r) \
0024             } while (-- (r) > 0); \
0025         } \
0026     }
0027 
0028 #define DD_1T(n, d, r, expr) \
0029     DD_WHILE(r)
0030 #define DD_2T(n, d, r, expr) \
0031     DD_CASE_I(1, expr) \
0032     DD_1T(n, d, r, expr)
0033 #define DD_3T(n, d, r, expr) \
0034     DD_CASE_I(2, expr) \
0035     DD_2T(n, d, r, expr)
0036 #define DD_4T(n, d, r, expr) \
0037     DD_CASE_I(3, expr) \
0038     DD_3T(n, d, r, expr)
0039 #define DD_5T(n, d, r, expr) \
0040     DD_CASE_I(4, expr) \
0041     DD_4T(n, d, r, expr)
0042 #define DD_6T(n, d, r, expr) \
0043     DD_CASE_I(5, expr) \
0044     DD_5T(n, d, r, expr)
0045 #define DD_7T(n, d, r, expr) \
0046     DD_CASE_I(6, expr) \
0047     DD_6T(n, d, r, expr)
0048 #define DD_8T(n, d, r, expr) \
0049     DD_CASE_I(7, expr) \
0050     DD_7T(n, d, r, expr)
0051 
0052 #define DD(n, d, r, expr) \
0053     DD_SWITCH(n, d, r, expr) \
0054     DD_##d##T(n, d, r, expr)
0055 
0056 #endif