summaryrefslogtreecommitdiff
path: root/app/lzo/src/lzo_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/lzo/src/lzo_init.c')
-rw-r--r--app/lzo/src/lzo_init.c188
1 files changed, 88 insertions, 100 deletions
diff --git a/app/lzo/src/lzo_init.c b/app/lzo/src/lzo_init.c
index 2872949c..4128a602 100644
--- a/app/lzo/src/lzo_init.c
+++ b/app/lzo/src/lzo_init.c
@@ -2,22 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
- Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -59,46 +44,35 @@
#if !defined(__LZO_IN_MINILZO)
-#define ACC_WANT_ACC_CHK_CH 1
-#undef ACCCHK_ASSERT
-#include "miniacc.h"
+#define LZO_WANT_ACC_CHK_CH 1
+#undef LZOCHK_ASSERT
+#include "lzo_supp.h"
- ACCCHK_ASSERT_IS_SIGNED_T(lzo_int)
- ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint)
-
- ACCCHK_ASSERT_IS_SIGNED_T(lzo_int32)
- ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint32)
- ACCCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0)
- ACCCHK_ASSERT(sizeof(lzo_uint32) >= 4)
-#if defined(LZO_UINT64_MAX)
- ACCCHK_ASSERT(sizeof(lzo_uint64) == 8)
- ACCCHK_ASSERT_IS_SIGNED_T(lzo_int64)
- ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uint64)
+ LZOCHK_ASSERT((LZO_UINT32_C(1) << (int)(8*sizeof(LZO_UINT32_C(1))-1)) > 0)
+ LZOCHK_ASSERT_IS_SIGNED_T(lzo_int)
+ LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uint)
+#if !(__LZO_UINTPTR_T_IS_POINTER)
+ LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t)
#endif
+ LZOCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp))
+ LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_xint)
-#if !defined(__LZO_UINTPTR_T_IS_POINTER)
- ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_uintptr_t)
#endif
- ACCCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp))
-
- ACCCHK_ASSERT_IS_UNSIGNED_T(lzo_xint)
- ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint32))
- ACCCHK_ASSERT(sizeof(lzo_xint) >= sizeof(lzo_uint))
- ACCCHK_ASSERT(sizeof(lzo_xint) == sizeof(lzo_uint32) || sizeof(lzo_xint) == sizeof(lzo_uint))
-
-#endif
-#undef ACCCHK_ASSERT
+#undef LZOCHK_ASSERT
/***********************************************************************
//
************************************************************************/
-#define WANT_lzo_bitops_clz32 1
-#define WANT_lzo_bitops_clz64 1
-#define WANT_lzo_bitops_ctz32 1
-#define WANT_lzo_bitops_ctz64 1
-#include "lzo_func.ch"
+union lzo_config_check_union {
+ lzo_uint a[2];
+ unsigned char b[2*LZO_MAX(8,sizeof(lzo_uint))];
+#if defined(lzo_uint64_t)
+ lzo_uint64_t c[2];
+#endif
+};
+
#if 0
#define u2p(ptr,off) ((lzo_voidp) (((lzo_bytep)(lzo_voidp)(ptr)) + (off)))
@@ -109,76 +83,90 @@ static __lzo_noinline lzo_voidp u2p(lzo_voidp ptr, lzo_uint off)
}
#endif
+
LZO_PUBLIC(int)
_lzo_config_check(void)
{
- lzo_bool r = 1;
- union {
- lzo_xint a[2]; unsigned char b[2*LZO_MAX(8,sizeof(lzo_xint))];
-#if defined(LZO_UNALIGNED_OK_8)
- lzo_uint64 c[2];
-#endif
- unsigned short x[2]; lzo_uint32 y[2]; lzo_uint z[2];
- } u;
+#if (LZO_CC_CLANG && (LZO_CC_CLANG >= 0x030100ul && LZO_CC_CLANG < 0x030300ul))
+# if 0
+ /* work around a clang 3.1 and clang 3.2 compiler bug; clang 3.3 and 3.4 work */
+ volatile
+# endif
+#endif
+ union lzo_config_check_union u;
lzo_voidp p;
+ unsigned r = 1;
u.a[0] = u.a[1] = 0;
p = u2p(&u, 0);
r &= ((* (lzo_bytep) p) == 0);
-#if !defined(LZO_CFG_NO_CONFIG_CHECK)
-#if defined(LZO_ABI_BIG_ENDIAN)
+#if !(LZO_CFG_NO_CONFIG_CHECK)
+#if (LZO_ABI_BIG_ENDIAN)
u.a[0] = u.a[1] = 0; u.b[sizeof(lzo_uint) - 1] = 128;
p = u2p(&u, 0);
r &= ((* (lzo_uintp) p) == 128);
#endif
-#if defined(LZO_ABI_LITTLE_ENDIAN)
+#if (LZO_ABI_LITTLE_ENDIAN)
u.a[0] = u.a[1] = 0; u.b[0] = 128;
p = u2p(&u, 0);
r &= ((* (lzo_uintp) p) == 128);
#endif
-#if defined(LZO_UNALIGNED_OK_2)
u.a[0] = u.a[1] = 0;
- u.b[0] = 1; u.b[sizeof(unsigned short) + 1] = 2;
+ u.b[0] = 1; u.b[3] = 2;
p = u2p(&u, 1);
- r &= ((* (lzo_ushortp) p) == 0);
-#endif
-#if defined(LZO_UNALIGNED_OK_4)
+ r &= UA_GET_NE16(p) == 0;
+ r &= UA_GET_LE16(p) == 0;
+ u.b[1] = 128;
+ r &= UA_GET_LE16(p) == 128;
u.a[0] = u.a[1] = 0;
- u.b[0] = 3; u.b[sizeof(lzo_uint32) + 1] = 4;
+ u.b[0] = 3; u.b[5] = 4;
p = u2p(&u, 1);
- r &= ((* (lzo_uint32p) p) == 0);
-#endif
-#if defined(LZO_UNALIGNED_OK_8)
+ r &= UA_GET_NE32(p) == 0;
+ r &= UA_GET_LE32(p) == 0;
+ u.b[1] = 128;
+ r &= UA_GET_LE32(p) == 128;
+#if defined(UA_GET_NE64)
u.c[0] = u.c[1] = 0;
- u.b[0] = 5; u.b[sizeof(lzo_uint64) + 1] = 6;
+ u.b[0] = 5; u.b[9] = 6;
p = u2p(&u, 1);
- r &= ((* (lzo_uint64p) p) == 0);
-#endif
-#if defined(lzo_bitops_clz32)
- { unsigned i; lzo_uint32 v = 1;
- for (i = 0; i < 32; i++, v <<= 1)
- r &= lzo_bitops_clz32(v) == 31 - i;
- }
-#endif
-#if defined(lzo_bitops_clz64)
- { unsigned i; lzo_uint64 v = 1;
- for (i = 0; i < 64; i++, v <<= 1)
- r &= lzo_bitops_clz64(v) == 63 - i;
- }
-#endif
-#if defined(lzo_bitops_ctz32)
- { unsigned i; lzo_uint32 v = 1;
- for (i = 0; i < 32; i++, v <<= 1)
- r &= lzo_bitops_ctz32(v) == i;
- }
-#endif
-#if defined(lzo_bitops_ctz64)
- { unsigned i; lzo_uint64 v = 1;
- for (i = 0; i < 64; i++, v <<= 1)
- r &= lzo_bitops_ctz64(v) == i;
- }
-#endif
-#endif
+ u.c[0] = u.c[1] = 0;
+ r &= UA_GET_NE64(p) == 0;
+#if defined(UA_GET_LE64)
+ r &= UA_GET_LE64(p) == 0;
+ u.b[1] = 128;
+ r &= UA_GET_LE64(p) == 128;
+#endif
+#endif
+#if defined(lzo_bitops_ctlz32)
+ { unsigned i = 0; lzo_uint32_t v;
+ for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
+ r &= lzo_bitops_ctlz32(v) == 31 - i;
+ r &= lzo_bitops_ctlz32_func(v) == 31 - i;
+ }}
+#endif
+#if defined(lzo_bitops_ctlz64)
+ { unsigned i = 0; lzo_uint64_t v;
+ for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
+ r &= lzo_bitops_ctlz64(v) == 63 - i;
+ r &= lzo_bitops_ctlz64_func(v) == 63 - i;
+ }}
+#endif
+#if defined(lzo_bitops_cttz32)
+ { unsigned i = 0; lzo_uint32_t v;
+ for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
+ r &= lzo_bitops_cttz32(v) == i;
+ r &= lzo_bitops_cttz32_func(v) == i;
+ }}
+#endif
+#if defined(lzo_bitops_cttz64)
+ { unsigned i = 0; lzo_uint64_t v;
+ for (v = 1; v != 0 && r == 1; v <<= 1, i++) {
+ r &= lzo_bitops_cttz64(v) == i;
+ r &= lzo_bitops_cttz64_func(v) == i;
+ }}
+#endif
+#endif
+ LZO_UNUSED_FUNC(lzo_bitops_unused_funcs);
return r == 1 ? LZO_E_OK : LZO_E_ERROR;
}
@@ -197,12 +185,12 @@ __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5,
#if defined(__LZO_IN_MINILZO)
#elif (LZO_CC_MSC && ((_MSC_VER) < 700))
#else
-#define ACC_WANT_ACC_CHK_CH 1
-#undef ACCCHK_ASSERT
-#define ACCCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr)
-#include "miniacc.h"
+#define LZO_WANT_ACC_CHK_CH 1
+#undef LZOCHK_ASSERT
+#define LZOCHK_ASSERT(expr) LZO_COMPILE_TIME_ASSERT(expr)
+#include "lzo_supp.h"
#endif
-#undef ACCCHK_ASSERT
+#undef LZOCHK_ASSERT
if (v == 0)
return LZO_E_ERROR;
@@ -210,7 +198,7 @@ __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5,
r = (s1 == -1 || s1 == (int) sizeof(short)) &&
(s2 == -1 || s2 == (int) sizeof(int)) &&
(s3 == -1 || s3 == (int) sizeof(long)) &&
- (s4 == -1 || s4 == (int) sizeof(lzo_uint32)) &&
+ (s4 == -1 || s4 == (int) sizeof(lzo_uint32_t)) &&
(s5 == -1 || s5 == (int) sizeof(lzo_uint)) &&
(s6 == -1 || s6 == (int) lzo_sizeof_dict_t) &&
(s7 == -1 || s7 == (int) sizeof(char *)) &&