diff options
author | Pete Zaitcev <zaitcev@kotori.zaitcev.us> | 2017-05-23 17:45:43 -0600 |
---|---|---|
committer | Thiago da Silva <thiago@redhat.com> | 2017-06-06 14:53:45 -0400 |
commit | 960cdd09dcabe5e125d8ee1c54fcc1f908e8ef11 (patch) | |
tree | 51e7d4237bedd2129b38fa3eb2b4733e59252fb0 /configure.ac | |
parent | de984f59e7a6cca8c1f3cf1d93b87ff144a2b974 (diff) | |
download | liberasurecode-960cdd09dcabe5e125d8ee1c54fcc1f908e8ef11.tar.gz |
Stop using ceill() to compute padded data size
The well-known idiom to compute a required number of data blocks
of size B to contain data of length d is:
(d + (B-1))/B
The code we use, with ceill(), computes the same value, but does
it in an unorthodox way. This makes a reviewer to doubt himself
and even run tests to make sure we're really computing the
obvious thing.
Apropos the reviewer confusion, the code in Phazr.IO looks weird.
It uses (word_size - hamming_distance) to compute the necessary
number of blocks... but then returns the amount of memory needed
to store blocks of a different size (word_size). We left all of it
alone and return exactly the same values that the old computation
returned.
All these computations were the only thing in the code that used
-lm, so drop that too.
Coincidentially, this patch solves the crash of distro-built
packages of liberasurecode (see Red Hat bug #1454543). But it's
a side effect. Expect a proper patch soon.
Change-Id: Ib297f6df304abf5ca8c27d3392b1107a525e0be0
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index c3509d2..d0230a0 100644 --- a/configure.ac +++ b/configure.ac @@ -88,7 +88,7 @@ dnl Check for C library headers AC_HEADER_STDC AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h \ malloc.h memory.h string.h strings.h inttypes.h \ - stdint.h ctype.h math.h iconv.h signal.h dlfcn.h \ + stdint.h ctype.h iconv.h signal.h dlfcn.h \ pthread.h unistd.h limits.h errno.h syslog.h) AC_CHECK_FUNCS(malloc calloc realloc free openlog) |