# LIME / inc / LIME_common.h

 ``` 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 39 40 41 42 43 44``` ```/**************************************************************** This header file contains common arithmetic definitions used by LIME. KISS. Copyright (C) 2008 NXP Semiconductors B.V. This file is part of LIME. LIME is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. LIME 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 General Public License for more details. You should have received a copy of the GNU General Public License along with LIME. If not, see . ****************************************************************/ #ifndef __COMMON__ #define __COMMON__ // Common defines #define lengthof(type) (sizeof type/sizeof type[0]) // Associative operations for collectives #define max(a,b) ( (a) >= (b) ? (a) : (b) ) #define min(a,b) ( (a) <= (b) ? (a) : (b) ) #define equ(a,b) ( (a) == (b) ) #define sum(a,b) ( (a) + (b) ) #define prod(a,b) ( (a) * (b) ) // g is the granule size #define roundup(s,g) ((s)/(g)+!!((s) % (g))) #define round_up(t,g) roundup(sizeof(t),g) // l is log2 of the granule size #define loground(s,l) (1+((((s)-1) & ~((1<<(l))-1))>>(l))) #define log_round(t,l) loground(sizeof(t),l) #endif//__COMMON__ ```