| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 | /* * StarPU * Copyright (C) INRIA 2008-2009 (see AUTHORS file) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU Lesser General Public License in COPYING.LGPL for more details. */#ifndef __STARPU_UTIL_H__#define __STARPU_UTIL_H__#include <stdio.h>#include <stdlib.h>#include <string.h>#include <assert.h>#include <starpu_config.h>#define STARPU_MIN(a,b)	((a)<(b)?(a):(b))#define STARPU_MAX(a,b)	((a)<(b)?(b):(a))#define STARPU_ASSERT(x)	assert(x)#define STARPU_UNLIKELY(expr)          (__builtin_expect(!!(expr),0))#define STARPU_LIKELY(expr)            (__builtin_expect(!!(expr),1))#ifdef HAVE_SYNC_BUILTINS#define STARPU_ATOMIC_ADD(ptr, value)  (__sync_fetch_and_add ((ptr), (value)) + (value))#define STARPU_ATOMIC_OR(ptr, value)  (__sync_fetch_and_or ((ptr), (value)))#else#error __sync_fetch_and_add is not available#endif#define STARPU_SUCCESS	0#define STARPU_TRYAGAIN	1#define STARPU_FATAL	2static int __attribute__ ((unused)) starpu_get_env_number(const char *str){	char *strval;	strval = getenv(str);	if (strval) {		/* the env variable was actually set */		unsigned val;		char *check;		val = (int)strtol(strval, &check, 10);		STARPU_ASSERT(strcmp(check, "\0") == 0);		//fprintf(stderr, "ENV %s WAS %d\n", str, val);		return val;	}	else {		/* there is no such env variable */		//fprintf("There was no %s ENV\n", str);		return -1;	}}#endif // __STARPU_UTIL_H__
 |