cl_ttl.h 1.05 KB
/*
 * cl_ttl.h
 *
 *  Created on: 21/05/2017
 *      Author: pedro
 */

#ifndef SRC_KERNELS_CL_TTL_H_
#define SRC_KERNELS_CL_TTL_H_

#if USE_TTL == 1

#define TTL_CTR_E , &ttl_ctr
#define TTL_CTR , unsigned int* ttl_ctr
#define TTL_CTR_V , ttl_ctr
#define CHECK_TTL_V(ttl_ctr, where) if ((ttl_ctr) >= TTL_LIMIT) { printf((__constant char *)"Exiting on TTL %u, %u, %d!\n", (where), (ttl_ctr), TTL_LIMIT); return; } else (ttl_ctr) = (ttl_ctr) + 1;
#define CHECK_TTL(ttl_ctr, where) if ((*(ttl_ctr)) >= TTL_LIMIT) { printf((__constant char *)"Exiting on TTL %u, %u, %d!\n", (where), (*(ttl_ctr)), TTL_LIMIT); return; } else (*(ttl_ctr)) = (*(ttl_ctr)) + 1;
#define CHECK_TTL_R(ttl_ctr, where) if ((*(ttl_ctr)) >= TTL_LIMIT) { printf((__constant char *)"Exiting on TTL %u, %u, %d!\n", (where), (*(ttl_ctr)), TTL_LIMIT); return 0; } else (*(ttl_ctr)) = (*(ttl_ctr)) + 1;

#else

#define CHECK_TTL_V(ttl_ctr, where)
#define CHECK_TTL(ttl_ctr, where)
#define CHECK_TTL_R(ttl_ctr, where)
#define TTL_CTR_E
#define TTL_CTR
#define TTL_CTR_V

#endif

#endif /* SRC_KERNELS_CL_TTL_H_ */