diff options
author | skidd13 <skidd13@openttd.org> | 2008-11-02 11:05:26 +0000 |
---|---|---|
committer | skidd13 <skidd13@openttd.org> | 2008-11-02 11:05:26 +0000 |
commit | 6043b4574e2ab17fcc7b2ae631deb22c61468c7e (patch) | |
tree | 533ed9ab5d3b13586a5ad264cdcc4584155faf85 /src/stdafx.h | |
parent | a4548a4b9be2ce4ece5b376374e519bfae78d403 (diff) | |
download | openttd-6043b4574e2ab17fcc7b2ae631deb22c61468c7e.tar.xz |
(svn r14553) -Doc: Add some doxygen comments
Diffstat (limited to 'src/stdafx.h')
-rw-r--r-- | src/stdafx.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/stdafx.h b/src/stdafx.h index 5ca14d082..34da8f501 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -305,8 +305,30 @@ assert_compile(sizeof(uint32) == 4); assert_compile(sizeof(uint16) == 2); assert_compile(sizeof(uint8) == 1); +/** + * Return the length of an fixed size array. + * Unlike sizeof this function returns the number of elements + * of the given type. + * + * @param x The pointer to the first element of the array + * @return The number of elements + */ #define lengthof(x) (sizeof(x) / sizeof(x[0])) + +/** + * Get the end element of an fixed size array. + * + * @param x The pointer to the first element of the array + * @return The pointer past to the last element of the array + */ #define endof(x) (&x[lengthof(x)]) + +/** + * Get the last element of an fixed size array. + * + * @param x The pointer to the first element of the array + * @return The pointer to the last element of the array + */ #define lastof(x) (&x[lengthof(x) - 1]) #define cpp_offsetof(s, m) (((size_t)&reinterpret_cast<const volatile char&>((((s*)(char*)8)->m))) - 8) |