Add an ARRAY_SIZE() macro which returns the size of an array, regardless
of the data types of the individual array elements. The macro is defined in lib.h, so code which uses it must include lib.h. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@413 f3766cd6-281f-0410-b1cd-43a5c92072e9
This commit is contained in:
parent
9b9e190491
commit
c81aa82942
5 changed files with 13 additions and 8 deletions
|
|
@ -21,6 +21,12 @@
|
|||
#ifndef LIB_H
|
||||
#define LIB_H
|
||||
|
||||
/**
|
||||
* Return the size of a given array, no matter of which data type
|
||||
* the individual array elements are.
|
||||
*/
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
int log2(unsigned int n);
|
||||
|
||||
void udelay(unsigned int usecs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue