diff options
author | Jeffrey Walton <noloader@gmail.com> | 2015-07-03 15:40:44 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2015-07-03 15:40:44 -0400 |
commit | f2379159f8dbda5fba74fae3e72be1c67acc0054 (patch) | |
tree | dfeeb86e0594fb3f1e9d61b3a11a8af042afd893 /misc.h | |
parent | 63dd0f5f5421f41ee6555237c859ace70d513b75 (diff) | |
download | cryptopp-git-f2379159f8dbda5fba74fae3e72be1c67acc0054.tar.gz |
Added COUNTOF to misc.h to count elements in an array (fails on pointers). Moved CRYPTOPP_UNUSED to misc.h
Diffstat (limited to 'misc.h')
-rw-r--r-- | misc.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -66,6 +66,18 @@ struct CompileAssert #define CRYPTOPP_ASSERT_JOIN(X, Y) CRYPTOPP_DO_ASSERT_JOIN(X, Y) #define CRYPTOPP_DO_ASSERT_JOIN(X, Y) X##Y +// ************** unused variable suppression *************** +// Cast to void. Portable way to suppress warning +#define CRYPTOPP_UNUSED(x) ((void)x) + +// ************** counting elements in an array *************** +// VS2005 added _countof macro, fails on pointers +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +# define COUNTOF(x) _countof(x) +#else +# define COUNTOF(x) (sizeof(x)/sizeof(x[0])) +#endif + // ************** misc classes *************** class CRYPTOPP_DLL Empty |