mirror of
https://github.com/libAthena/athena.git
synced 2025-12-21 10:49:11 +00:00
* Fix styling
This commit is contained in:
104
extern/lzo/src/lzo_init.c
vendored
104
extern/lzo/src/lzo_init.c
vendored
@@ -48,14 +48,14 @@
|
||||
#undef LZOCHK_ASSERT
|
||||
#include "lzo_supp.h"
|
||||
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
LZOCHK_ASSERT(sizeof(lzo_uintptr_t) >= sizeof(lzo_voidp))
|
||||
LZOCHK_ASSERT_IS_UNSIGNED_T(lzo_xint)
|
||||
|
||||
#endif
|
||||
#undef LZOCHK_ASSERT
|
||||
@@ -65,9 +65,10 @@
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
union lzo_config_check_union {
|
||||
union lzo_config_check_union
|
||||
{
|
||||
lzo_uint a[2];
|
||||
unsigned char b[2*LZO_MAX(8,sizeof(lzo_uint))];
|
||||
unsigned char b[2 * LZO_MAX(8, sizeof(lzo_uint))];
|
||||
#if defined(lzo_uint64_t)
|
||||
lzo_uint64_t c[2];
|
||||
#endif
|
||||
@@ -79,7 +80,7 @@ union lzo_config_check_union {
|
||||
#else
|
||||
static __lzo_noinline lzo_voidp u2p(lzo_voidp ptr, lzo_uint off)
|
||||
{
|
||||
return (lzo_voidp) ((lzo_bytep) ptr + off);
|
||||
return (lzo_voidp)((lzo_bytep) ptr + off);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -102,17 +103,20 @@ _lzo_config_check(void)
|
||||
r &= ((* (lzo_bytep) p) == 0);
|
||||
#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;
|
||||
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 (LZO_ABI_LITTLE_ENDIAN)
|
||||
u.a[0] = u.a[1] = 0; u.b[0] = 128;
|
||||
u.a[0] = u.a[1] = 0;
|
||||
u.b[0] = 128;
|
||||
p = u2p(&u, 0);
|
||||
r &= ((* (lzo_uintp) p) == 128);
|
||||
#endif
|
||||
u.a[0] = u.a[1] = 0;
|
||||
u.b[0] = 1; u.b[3] = 2;
|
||||
u.b[0] = 1;
|
||||
u.b[3] = 2;
|
||||
p = u2p(&u, 1);
|
||||
r &= UA_GET_NE16(p) == 0;
|
||||
r &= UA_GET_LE16(p) == 0;
|
||||
@@ -127,13 +131,16 @@ _lzo_config_check(void)
|
||||
r &= UA_GET_NE16(p) == LZO_UINT16_C(0x8180);
|
||||
#endif
|
||||
u.a[0] = u.a[1] = 0;
|
||||
u.b[0] = 3; u.b[5] = 4;
|
||||
u.b[0] = 3;
|
||||
u.b[5] = 4;
|
||||
p = u2p(&u, 1);
|
||||
r &= UA_GET_NE32(p) == 0;
|
||||
r &= UA_GET_LE32(p) == 0;
|
||||
u.b[1] = 128;
|
||||
r &= UA_GET_LE32(p) == 128;
|
||||
u.b[2] = 129; u.b[3] = 130; u.b[4] = 131;
|
||||
u.b[2] = 129;
|
||||
u.b[3] = 130;
|
||||
u.b[4] = 131;
|
||||
r &= UA_GET_LE32(p) == LZO_UINT32_C(0x83828180);
|
||||
#if (LZO_ABI_BIG_ENDIAN)
|
||||
r &= UA_GET_NE32(p) == LZO_UINT32_C(0x80818283);
|
||||
@@ -143,7 +150,8 @@ _lzo_config_check(void)
|
||||
#endif
|
||||
#if defined(UA_GET_NE64)
|
||||
u.c[0] = u.c[1] = 0;
|
||||
u.b[0] = 5; u.b[9] = 6;
|
||||
u.b[0] = 5;
|
||||
u.b[9] = 6;
|
||||
p = u2p(&u, 1);
|
||||
u.c[0] = u.c[1] = 0;
|
||||
r &= UA_GET_NE64(p) == 0;
|
||||
@@ -154,32 +162,52 @@ _lzo_config_check(void)
|
||||
#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;
|
||||
}}
|
||||
{
|
||||
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;
|
||||
}}
|
||||
{
|
||||
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;
|
||||
}}
|
||||
{
|
||||
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;
|
||||
}}
|
||||
{
|
||||
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);
|
||||
@@ -194,7 +222,7 @@ _lzo_config_check(void)
|
||||
|
||||
LZO_PUBLIC(int)
|
||||
__lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5,
|
||||
int s6, int s7, int s8, int s9)
|
||||
int s6, int s7, int s8, int s9)
|
||||
{
|
||||
int r;
|
||||
|
||||
@@ -217,13 +245,15 @@ __lzo_init_v2(unsigned v, int s1, int s2, int s3, int s4, int s5,
|
||||
(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 *)) &&
|
||||
(s7 == -1 || s7 == (int) sizeof(char*)) &&
|
||||
(s8 == -1 || s8 == (int) sizeof(lzo_voidp)) &&
|
||||
(s9 == -1 || s9 == (int) sizeof(lzo_callback_t));
|
||||
|
||||
if (!r)
|
||||
return LZO_E_ERROR;
|
||||
|
||||
r = _lzo_config_check();
|
||||
|
||||
if (r != LZO_E_OK)
|
||||
return r;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user