minor static assert for 32/64 bits system. Suggested by @ebiggers

This commit is contained in:
Yann Collet 2016-07-17 15:53:18 +02:00
parent 972e5806ee
commit d54b2d23b4
2 changed files with 10 additions and 5 deletions

3
NEWS
View File

@ -1,3 +1,6 @@
v0.7.5
Fixed : premature end of frame when zero-sized raw block, reported by Eric Biggers
v0.7.4
Added : homebrew for Mac
Added : more examples

View File

@ -44,16 +44,14 @@ extern "C" {
******************************************/
#include <stddef.h> /* size_t, ptrdiff_t */
#include <string.h> /* memcpy */
#if defined(_MSC_VER) /* Visual Studio */
# include <stdlib.h> /* _byteswap_ulong */
#endif
/*-****************************************
* Compiler specifics
******************************************/
#if defined(_MSC_VER)
# include <intrin.h> /* _byteswap_ */
#if defined(_MSC_VER) /* Visual Studio */
# include <stdlib.h> /* _byteswap_ulong */
# include <intrin.h> /* _byteswap_* */
#endif
#if defined(__GNUC__)
# define MEM_STATIC static __attribute__((unused))
@ -65,6 +63,10 @@ extern "C" {
# define MEM_STATIC static /* this version may generate warnings for unused static functions; disable the relevant warning */
#endif
/* code only tested on 32 and 64 bits systems */
#define MEM_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(int)(!!(c)) }; }
MEM_STATIC void MEM_check(void) { MEM_STATIC_ASSERT((sizeof(size_t)==4) || (sizeof(size_t)==8)); }
/*-**************************************************************
* Basic Types