mirror of
https://github.com/openvswitch/ovs
synced 2025-10-19 14:37:21 +00:00
util: Move bitwise_copy() here, add new bitwise functions, add a test.
bitwise_copy() is generally useful so make it a general utility function. Also add a comment. Upcoming commits will introduce users for the new functions. Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
14
lib/random.c
14
lib/random.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
|
||||
* Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -100,6 +100,18 @@ random_uint32(void)
|
||||
return random_next();
|
||||
}
|
||||
|
||||
uint64_t
|
||||
random_uint64(void)
|
||||
{
|
||||
uint64_t x;
|
||||
|
||||
random_init();
|
||||
|
||||
x = random_next();
|
||||
x |= (uint64_t) random_next() << 32;
|
||||
return x;
|
||||
}
|
||||
|
||||
int
|
||||
random_range(int max)
|
||||
{
|
||||
|
Reference in New Issue
Block a user