summaryrefslogtreecommitdiff
path: root/lib/bch.c
diff options
context:
space:
mode:
authorEmmanuel Vadot <manu@bidouilliste.com>2017-06-20 07:02:29 (GMT)
committerTom Rini <trini@konsulko.com>2017-06-20 18:03:33 (GMT)
commit4ecc988301bc8e981e6d7538c57cdb3aa82f7c1d (patch)
tree383cd923b33c792cd13c8e65dc6fc350523cf655 /lib/bch.c
parente2351d5cf1e97408b4c52bafeaa85e0ca85c920c (diff)
downloadu-boot-4ecc988301bc8e981e6d7538c57cdb3aa82f7c1d.tar.xz
bch: Fix build on FreeBSD host
endian.h on FreeBSD system exist in sys/ subdirectory. FreeBSD already have a fls function defined in strings.h which is included in string.h if __BSD_VISIBLE is defined, as a check for this. Signed-off-by: Emmanuel Vadot <manu@bidouilliste.com>
Diffstat (limited to 'lib/bch.c')
-rw-r--r--lib/bch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/bch.c b/lib/bch.c
index ec53483..7a2d9d3 100644
--- a/lib/bch.c
+++ b/lib/bch.c
@@ -61,7 +61,11 @@
#include <linux/bitops.h>
#else
#include <errno.h>
+#if defined(__FreeBSD__)
+#include <sys/endian.h>
+#else
#include <endian.h>
+#endif
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -113,6 +117,7 @@ struct gf_poly_deg1 {
};
#ifdef USE_HOSTCC
+#ifndef __BSD_VISIBLE
static int fls(int x)
{
int r = 32;
@@ -142,6 +147,7 @@ static int fls(int x)
return r;
}
#endif
+#endif
/*
* same as encode_bch(), but process input data one byte at a time