summaryrefslogtreecommitdiffstats
path: root/include/stdlib.h
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-06-04 10:46:59 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-09 12:20:05 +0200
commit891d7a3b4a3a55d41156da4a6c2221d97cf857c5 (patch)
tree04a8ec9df6533efa022b5c67897ef347997e4ec5 /include/stdlib.h
parent7457c3d1d457922772e8bb7e07e3e9fe7dd0e09d (diff)
downloadbarebox-891d7a3b4a3a55d41156da4a6c2221d97cf857c5.tar.gz
barebox-891d7a3b4a3a55d41156da4a6c2221d97cf857c5.tar.xz
test: self: port Linux printf kselftest
Port over the Linux v5.11 selftest for printf sans the parts we don't support. This can be used to catch regressions if changes affecting the printf code are made. Acked-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210604084704.17410-9-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/stdlib.h')
-rw-r--r--include/stdlib.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index d405608724..8eb419e111 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -25,4 +25,9 @@ static inline u32 random32(void)
return ret;
}
+static inline u32 prandom_u32_max(u32 ep_ro)
+{
+ return (u32)(((u64) random32() * ep_ro) >> 32);
+}
+
#endif /* __STDLIB_H */