aboutsummaryrefslogtreecommitdiff
path: root/pixman/test/utils.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-12-10 08:33:13 +0100
committermarha <marha@users.sourceforge.net>2012-12-10 08:33:13 +0100
commit0328076efb5ff6e62152c09e38d0d11f7931d07b (patch)
treece71cf0fe95186671dc75862c2ced47f4735214f /pixman/test/utils.c
parente82692e521240c5f8592f9ce56c9d5b3d68870ec (diff)
downloadvcxsrv-0328076efb5ff6e62152c09e38d0d11f7931d07b.tar.gz
vcxsrv-0328076efb5ff6e62152c09e38d0d11f7931d07b.tar.bz2
vcxsrv-0328076efb5ff6e62152c09e38d0d11f7931d07b.zip
fontconfig libX11 mesa pixman git update 10 dec 2012
libX11 9833489e6c3829a1e835bc0a11f028fc180809e4 mesa 17f5dc57306b8f5079304701e455bf4b927d3cae pixman 8ca4e144724ba2041bc5ef077ccf6d24e7cf4d1f fontconfig 608c5b590bd3428dfcd30f3d68ee8b7131e2f019
Diffstat (limited to 'pixman/test/utils.c')
-rw-r--r--pixman/test/utils.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/pixman/test/utils.c b/pixman/test/utils.c
index c887a6db9..66c8dcb89 100644
--- a/pixman/test/utils.c
+++ b/pixman/test/utils.c
@@ -27,10 +27,11 @@
#include <png.h>
#endif
-/* Random number seed
+/* Random number generator state
*/
-uint32_t lcg_seed;
+prng_t prng_state_data;
+prng_t *prng_state;
/*----------------------------------------------------------------------------*\
* CRC-32 version 2.0.0 by Craig Bruce, 2006-04-29.
@@ -237,14 +238,6 @@ compute_crc32_for_image (uint32_t crc32,
return crc32;
}
-pixman_bool_t
-is_little_endian (void)
-{
- volatile uint16_t endian_check_var = 0x1234;
-
- return (*(volatile uint8_t *)&endian_check_var == 0x34);
-}
-
/* perform endian conversion of pixel data
*/
void
@@ -431,13 +424,11 @@ uint8_t *
make_random_bytes (int n_bytes)
{
uint8_t *bytes = fence_malloc (n_bytes);
- int i;
if (!bytes)
return NULL;
- for (i = 0; i < n_bytes; ++i)
- bytes[i] = lcg_rand () & 0xff;
+ prng_randmemset (bytes, n_bytes, 0);
return bytes;
}
@@ -689,9 +680,9 @@ get_random_seed (void)
{
union { double d; uint32_t u32; } t;
t.d = gettime();
- lcg_srand (t.u32);
+ prng_srand (t.u32);
- return lcg_rand_u32 ();
+ return prng_rand ();
}
#ifdef HAVE_SIGACTION
@@ -785,7 +776,7 @@ initialize_palette (pixman_indexed_t *palette, uint32_t depth, int is_rgb)
uint32_t mask = (1 << depth) - 1;
for (i = 0; i < 32768; ++i)
- palette->ent[i] = lcg_rand() & mask;
+ palette->ent[i] = prng_rand() & mask;
memset (palette->rgba, 0, sizeof (palette->rgba));
@@ -805,7 +796,7 @@ initialize_palette (pixman_indexed_t *palette, uint32_t depth, int is_rgb)
{
uint32_t old_idx;
- rgba24 = lcg_rand();
+ rgba24 = prng_rand();
i15 = CONVERT_15 (rgba24, is_rgb);
old_idx = palette->ent[i15];