summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2015-09-08 17:14:08 +0200
committerJulius Werner <jwerner@chromium.org>2015-09-10 20:11:33 +0000
commit66cc843f3d70a38c44f49077bcc7663ad685aef4 (patch)
treec21dd84b5745b5df93088afd4a3faa68d6a8454c /payloads/libpayload
parent94a74998c08fd485656175faf0cba6583f615070 (diff)
downloadcoreboot-66cc843f3d70a38c44f49077bcc7663ad685aef4.tar.xz
libpayload: Revive ffs()
Revive ffs() in a more fancy way (that is more likely to be accepted). We dropped it in 7a8a4ab lib: Unify log2() and related functions but there is at least one user: flashrom. Change-Id: I4e3fc15816b778e640bceea0d89cd9624d271c2e Signed-off-by: Nico Huber <nico.huber@secunet.com> Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: http://review.coreboot.org/11591 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/include/strings.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/payloads/libpayload/include/strings.h b/payloads/libpayload/include/strings.h
new file mode 100644
index 0000000000..e25a823df0
--- /dev/null
+++ b/payloads/libpayload/include/strings.h
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the libpayload project.
+ *
+ * Copyright (C) 2011 secunet Security Networks AG
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _STRINGS_H
+#define _STRINGS_H
+
+#include <libpayload.h>
+
+static inline int ffs(int i) { return __ffs(i) + 1; }
+
+#endif