Skip to content

Commit 5209b19

Browse files
committed
rt: Rename rand() to isaac_rand() since the former prevents lots of standard headers from being included
1 parent 3079577 commit 5209b19

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/rt/isaac/rand.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ void isaac(randctx *r);
4343

4444
/*
4545
------------------------------------------------------------------------------
46-
Call rand(/o_ randctx *r _o/) to retrieve a single 32-bit random value
46+
Call isaac_rand(/o_ randctx *r _o/) to retrieve a single 32-bit random value
4747
------------------------------------------------------------------------------
4848
*/
49-
#define rand(r) \
49+
#define isaac_rand(r) \
5050
(!(r)->randcnt-- ? \
5151
(isaac(r), (r)->randcnt=RANDSIZ-1, (r)->randrsl[(r)->randcnt]) : \
5252
(r)->randrsl[(r)->randcnt])

src/rt/rust_builtin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ rand_new(rust_task *task)
151151
extern "C" CDECL size_t
152152
rand_next(rust_task *task, randctx *rctx)
153153
{
154-
return rand(rctx);
154+
return isaac_rand(rctx);
155155
}
156156

157157
extern "C" CDECL void

src/rt/rust_kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ rust_kernel::fail() {
150150

151151
rust_task_id
152152
rust_kernel::create_task(rust_task *spawner, const char *name) {
153-
rust_scheduler *thread = threads[rand(&rctx) % num_threads];
153+
rust_scheduler *thread = threads[isaac_rand(&rctx) % num_threads];
154154
rust_task *t = thread->create_task(spawner, name);
155155
{
156156
scoped_lock with(_kernel_lock);

src/rt/rust_scheduler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ rust_scheduler::schedule_task(int id) {
179179
// FIXME: in the face of failing tasks, this is not always right.
180180
// I(this, n_live_tasks() > 0);
181181
if (running_tasks.length() > 0) {
182-
size_t k = rand(&rctx);
182+
size_t k = isaac_rand(&rctx);
183183
// Look around for a runnable task, starting at k.
184184
for(size_t j = 0; j < running_tasks.length(); ++j) {
185185
size_t i = (j + k) % running_tasks.length();

0 commit comments

Comments
 (0)