summaryrefslogtreecommitdiff
path: root/src/lzo_ptr.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-06-22 16:59:16 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-06-22 16:59:39 +0900
commit8ff61daa672f051d8ecb537edc94036b6cdaaf3f (patch)
tree455cc4eb438541a1ff3e7bb50c7abc458f189269 /src/lzo_ptr.c
parent79a9578a33ecd3093970bd18df677edc9214fafb (diff)
downloadlzo-8ff61daa672f051d8ecb537edc94036b6cdaaf3f.tar.gz
lzo-8ff61daa672f051d8ecb537edc94036b6cdaaf3f.tar.bz2
lzo-8ff61daa672f051d8ecb537edc94036b6cdaaf3f.zip
Imported Upstream version 2.09
Change-Id: Iff3c94491fe695b43f1d6998f93f56af871806a2 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'src/lzo_ptr.c')
-rw-r--r--src/lzo_ptr.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lzo_ptr.c b/src/lzo_ptr.c
index 2896b70..38359ff 100644
--- a/src/lzo_ptr.c
+++ b/src/lzo_ptr.c
@@ -2,7 +2,7 @@
This file is part of the LZO real-time data compression library.
- Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library is free software; you can redistribute it and/or
@@ -61,18 +61,20 @@ __lzo_align_gap(const lzo_voidp ptr, lzo_uint size)
#error "__LZO_UINTPTR_T_IS_POINTER is unsupported"
#else
lzo_uintptr_t p, n;
+ if (size < 2) return 0;
p = __lzo_ptr_linear(ptr);
+#if 0
n = (((p + size - 1) / size) * size) - p;
+#else
+ if ((size & (size - 1)) != 0)
+ return 0;
+ n = size; n = ((p + n - 1) & ~(n - 1)) - p;
+#endif
#endif
-
- assert(size > 0);
assert((long)n >= 0);
assert(n <= size);
return (unsigned)n;
}
-
-/*
-vi:ts=4:et
-*/
+/* vim:set ts=4 sw=4 et: */