[Pixman] [PATCH] test: Fix for strict aliasing issue in 'get_random_seed'

Siarhei Siamashka siarhei.siamashka at gmail.com
Sun Jun 24 03:00:17 PDT 2012


---
 test/utils.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/utils.c b/test/utils.c
index 0abc32c..563b33d 100644
--- a/test/utils.c
+++ b/test/utils.c
@@ -686,9 +686,9 @@ gettime (void)
 uint32_t
 get_random_seed (void)
 {
-    double d = gettime();
-
-    lcg_srand (*(uint32_t *)&d);
+    union { double d; uint32_t u32; } t;
+    t.d = gettime();
+    lcg_srand (t.u32);
 
     return lcg_rand_u32 ();
 }
-- 
1.7.3.4



More information about the Pixman mailing list