File: 0008-test-hashing-support-32-bit.patch

package info (click to toggle)
guile-3.0 3.0.10%2Breally3.0.10-4
  • links: PTS
  • area: main
  • in suites: trixie
  • size: 35,752 kB
  • sloc: ansic: 183,632; lisp: 99,770; sh: 4,603; makefile: 1,843; awk: 239; javascript: 9
file content (34 lines) | stat: -rw-r--r-- 1,319 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 575aa68845e23238a3351c0de28a2b3d9b13b5ec Mon Sep 17 00:00:00 2001
From: Rob Browning <rlb@defaultvalue.org>
Date: Mon, 1 Jul 2024 02:14:37 -0500
Subject: test-hashing: support 32-bit

* test-suite/standalone/test-hashing.c (test_hashing): add expected
value for 32-bit architectures.

Origin: upstream, commit ad1f56675be58fbb7bfee6fab166ff5bf0b36a11
---
 test-suite/standalone/test-hashing.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/test-suite/standalone/test-hashing.c b/test-suite/standalone/test-hashing.c
index 5982a0fdb..50e132989 100644
--- a/test-suite/standalone/test-hashing.c
+++ b/test-suite/standalone/test-hashing.c
@@ -38,9 +38,15 @@ test_hashing ()
 
   // Value determined by calling wide_string_hash on {0x3A0, 0x3B5,
   // 0x3C1, 0x3AF} via a temporary test program.
+#if SIZEOF_UNSIGNED_LONG == 8
   const unsigned long expect = 4029223418961680680;
-  const unsigned long actual = scm_to_ulong (scm_symbol_hash (sym));
+#elif SIZEOF_UNSIGNED_LONG == 4
+  const unsigned long expect = 938126682;
+#else
+#error "unsigned long not 4 or 8 bytes (need additonal test data)"
+#endif
 
+  const unsigned long actual = scm_to_ulong (scm_symbol_hash (sym));
   if (actual != expect)
     {
       fprintf (stderr, "fail: unexpected utf-8 symbol hash (%lu != %lu)\n",