diff options
Diffstat (limited to 'pixman/test/utils.h')
-rw-r--r-- | pixman/test/utils.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/pixman/test/utils.h b/pixman/test/utils.h index 615ad7841..f0c9c300c 100644 --- a/pixman/test/utils.h +++ b/pixman/test/utils.h @@ -44,10 +44,14 @@ lcg_rand_N (int max) static inline uint32_t lcg_rand_u32 (void) { - uint32_t lo = lcg_rand(); - uint32_t hi = lcg_rand(); - - return (hi << 16) | lo; + /* This uses the 10/11 most significant bits from the 3 lcg results + * (and mixes them with the low from the adjacent one). + */ + uint32_t lo = lcg_rand() >> -(32 - 15 - 11 * 2); + uint32_t mid = lcg_rand() << (32 - 15 - 11 * 1); + uint32_t hi = lcg_rand() << (32 - 15 - 11 * 0); + + return (hi ^ mid ^ lo); } /* CRC 32 computation @@ -57,6 +61,10 @@ compute_crc32 (uint32_t in_crc32, const void *buf, size_t buf_len); +/* Returns TRUE if running on a little endian system */ +pixman_bool_t +is_little_endian (void); + /* perform endian conversion of pixel data */ void |