summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index a2e58c0..04a30e7 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1284,17 +1284,25 @@ LZ4_stream_t* LZ4_createStream(void)
return lz4s;
}
+#ifndef _MSC_VER /* for some reason, Visual fails the aligment test on 32-bit x86 :
+ it reports an aligment of 8-bytes,
+ while actually aligning LZ4_stream_t on 4 bytes. */
static size_t LZ4_stream_t_alignment(void)
{
struct { char c; LZ4_stream_t t; } t_a;
return sizeof(t_a) - sizeof(t_a.t);
}
+#endif
LZ4_stream_t* LZ4_initStream (void* buffer, size_t size)
{
DEBUGLOG(5, "LZ4_initStream");
if (size < sizeof(LZ4_stream_t)) return NULL;
+#ifndef _MSC_VER /* for some reason, Visual fails the aligment test on 32-bit x86 :
+ it reports an aligment of 8-bytes,
+ while actually aligning LZ4_stream_t on 4 bytes. */
if (((size_t)buffer) & (LZ4_stream_t_alignment() - 1)) return NULL; /* alignment check */
+#endif
MEM_INIT(buffer, 0, sizeof(LZ4_stream_t));
return (LZ4_stream_t*)buffer;
}