Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Sunxi Tools
Commits
49778862
Commit
49778862
authored
May 12, 2012
by
Alejandro Mery
Browse files
common: add ARRAY_SIZE() macro
parent
e36d3866
Changes
1
Hide whitespace changes
Inline
Side-by-side
common.h
View file @
49778862
...
@@ -32,6 +32,11 @@
...
@@ -32,6 +32,11 @@
#define container_of(P,T,M) (T *)((char *)(P) - offsetof(T, M))
#define container_of(P,T,M) (T *)((char *)(P) - offsetof(T, M))
#endif
#endif
/** calculate number of elements of an array */
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(A) (sizeof(A)/sizeof((A)[0]))
#endif
/** shortcut to printf to stderr */
/** shortcut to printf to stderr */
#define errf(...) fprintf(stderr, __VA_ARGS__)
#define errf(...) fprintf(stderr, __VA_ARGS__)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment