From 325059203d4b2945e5dd5aa7806e1fd3bba45089 Mon Sep 17 00:00:00 2001 From: bakpakin Date: Sun, 9 Jul 2017 13:09:20 -0400 Subject: [PATCH] Correct behavior on 32 bit architecture when hashing pointers. --- core/value.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/value.c b/core/value.c index d2b07ab5..5dbbf50b 100644 --- a/core/value.c +++ b/core/value.c @@ -77,7 +77,13 @@ uint32_t gst_hash(GstValue x) { hash = gst_struct_hash(x.data.st); break; default: - hash = x.data.dwords[0] ^ x.data.dwords[1]; + if (sizeof(double) == sizeof(void *)) { + /* Assuming 8 byte pointer */ + hash = x.data.dwords[0] ^ x.data.dwords[1]; + } else { + /* Assuming 4 byte pointer (or smaller) */ + hash = (uint32_t) x.data.pointer; + } break; } return hash;