1 // SPDX-FileCopyrightText: 1996 Ulrich Drepper <drepper@cygnus.com>
2 // SPDX-FileCopyrightText: 2013 Pierre-Luc St-Charles <pierre-luc.st-charles@polymtl.ca>
4 // SPDX-License-Identifier: LGPL-2.1-or-later
10 * Userspace RCU library - rand/rand_r Compatibility Header
12 * Note: this file is only used to simplify the code required to
13 * use the 'rand_r(...)' system function across multiple platforms,
14 * which might not always be referenced the same way.
19 * Reentrant random function from POSIX.1c.
20 * Copyright (C) 1996, 1999 Free Software Foundation, Inc.
21 * This file is part of the GNU C Library.
22 * Contributed by Ulrich Drepper <drepper@cygnus.com <mailto:drepper@cygnus.com>>, 1996.
24 static inline int rand_r(unsigned int *seed
)
26 unsigned int next
= *seed
;
31 result
= (unsigned int) (next
/ 65536) % 2048;
36 result
^= (unsigned int) (next
/ 65536) % 1024;
41 result
^= (unsigned int) (next
/ 65536) % 1024;
47 #endif /* HAVE_RAND_R */
49 #endif /* _COMPAT_RAND_H */
This page took 0.029936 seconds and 4 git commands to generate.