aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/vasp/source/oploop.h
blob: 6b26802274dfd57f1381584c4efbde0b79d90e9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* 

VASP modular - vector assembling signal processor / objects for Max/MSP and PD

Copyright (c) 2002 Thomas Grill (xovo@gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.  

*/

#ifndef __VASP_OPLOOP_H
#define __VASP_OPLOOP_H

#define _D_BLOCK 1024

#define _D_MIN(a,b) ((a) < (b)?(a):(b))

#ifdef FLEXT_THREADS
#define _D_LOOP(VAR,LEN) { \
	register I __i__; \
	for(__i__ = 0; __i__ < LEN; flext_base::ThrYield()) { \
	I __m__ = _D_MIN(LEN,__i__+_D_BLOCK); for(; (VAR = __i__) < __m__; ++__i__) {
#define _E_LOOP	} if(__i__ < __m__) break; }}
#define _D_WHILE(COND) { \
	for(; (COND) ; flext_base::ThrYield()) { \
	register I __i__ = 0;  \
	for(; __i__ < _D_BLOCK && (COND); ++__i__) {
#define _E_WHILE } if(__i__ < _D_BLOCK) break; }}
#else
#define _D_LOOP(VAR,LEN) { \
	for(VAR = 0; VAR < LEN; ++VAR) {
#define _E_LOOP }}
#define _D_WHILE(COND) { \
	while(COND) {
#define _E_WHILE }}
#endif

#endif