X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=compiler.h;h=142b9a60fa98c011096a1fba025d962e63b07520;hp=2507ec88a0a6a6fbb11e84f73843bb042a9d850e;hb=1050892f30b28680a92f7d6966656d688201037b;hpb=af02d47e5d0712e5ccde6d8f1ee89f18de798cad diff --git a/compiler.h b/compiler.h index 2507ec8..142b9a6 100644 --- a/compiler.h +++ b/compiler.h @@ -8,28 +8,20 @@ * * Copyright (c) 2009 Mathieu Desnoyers * - * This library 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 library 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 for more details. + * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED + * OR IMPLIED. ANY USE IS AT YOUR OWN RISK. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * IBM's contributions to this file may be relicensed under LGPLv2 or later. + * Permission is hereby granted to use or copy this program + * for any purpose, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. */ -/* The "volatile" is due to gcc bugs */ -#define barrier() __asm__ __volatile__("": : :"memory") +#define likely(x) __builtin_expect(!!(x), 1) +#define unlikely(x) __builtin_expect(!!(x), 0) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) +#define barrier() asm volatile("" : : : "memory"); /* * Instruct the compiler to perform only a single access to a variable @@ -43,6 +35,6 @@ * use is to mediate communication between process-level code and irq/NMI * handlers, all running on the same CPU. */ -#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) +#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&x) #endif /* _COMPILER_H */