source: tags/ms_r18q1/TEMPLATES/arb_defs.h

Last change on this file was 15529, checked in by westram, 7 years ago
File size: 1.4 KB
Line 
1// ================================================================= //
2//                                                                   //
3//   File      : arb_defs.h                                          //
4//   Purpose   : global defines and mini inlines                     //
5//                                                                   //
6//   Coded by Ralf Westram (coder@reallysoft.de) in September 2010   //
7//   Institute of Microbiology (Technical University Munich)         //
8//   http://www.arb-home.de/                                         //
9//                                                                   //
10// ================================================================= //
11
12#ifndef ARB_DEFS_H
13#define ARB_DEFS_H
14
15#ifndef ARB_ASSERT_H
16#include <arb_assert.h>
17#endif
18
19#define ARRAY_ELEMS(array)            (sizeof(array)/sizeof(array[0]))
20#define TERMINATED_ARRAY_ELEMS(array) (ARRAY_ELEMS(array)-1)
21
22// Internally ARB shall use position [0..N-1] for calculations.
23// Only while showing positions to the user, we use [1..N] (as well in displayed AWARs).
24// Please use the following functions to make the conversion explicit:
25
26ASSERTING_CONSTEXPR_INLINE int bio2info(int biopos) { arb_assert(biopos >= 1); return biopos-1; }
27ASSERTING_CONSTEXPR_INLINE int info2bio(int infopos) { arb_assert(infopos >= 0); return infopos+1; }
28
29
30#else
31#error arb_defs.h included twice
32#endif // ARB_DEFS_H
Note: See TracBrowser for help on using the repository browser.