From 960cdd09dcabe5e125d8ee1c54fcc1f908e8ef11 Mon Sep 17 00:00:00 2001 From: Pete Zaitcev Date: Tue, 23 May 2017 17:45:43 -0600 Subject: 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 --- include/erasurecode/erasurecode_stdinc.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/erasurecode/erasurecode_stdinc.h b/include/erasurecode/erasurecode_stdinc.h index 903b33e..aaa9e2b 100644 --- a/include/erasurecode/erasurecode_stdinc.h +++ b/include/erasurecode/erasurecode_stdinc.h @@ -100,9 +100,6 @@ #ifdef HAVE_ERRNO_H # include #endif -#ifdef HAVE_MATH_H -# include -#endif #if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) -- cgit v1.2.1