cityhash unit test fails on PowerPC FreeBSD system

48 views
Skip to first unread message

Nick Briggs

unread,
Apr 30, 2013, 7:13:11 PM4/30/13
to cityhash...@googlegroups.com
Since it asks for a report --

make check-TESTS
ERROR: expected 0x99929334, but got 0xf17ccd
ERROR: expected 0x4252edb7, but got 0xe31c559c
ERROR: expected 0xebc34f3c, but got 0x925c89c6
ERROR: expected 0x26f2b463, but got 0x8c57fdfd
FAIL: cityhash_unittest
==================================================
1 of 1 test failed
Please report to cityhash...@googlegroups.com
==================================================

The source is:

URL: http://cityhash.googlecode.com/svn/trunk
Repository Root: http://cityhash.googlecode.com/svn
Repository UUID: 325e1591-7dc4-fa6a-e451-e4e085be5db0
Revision: 11
Node Kind: directory
Schedule: normal
Last Changed Author: gp...@google.com
Last Changed Rev: 11
Last Changed Date: 2012-10-24 16:24:12 -0700 (Wed, 24 Oct 2012)

with the addition of:

--- src/city.cc (revision 11)
+++ src/city.cc (working copy)
@@ -53,6 +53,11 @@
#define bswap_32(x) _byteswap_ulong(x)
#define bswap_64(x) _byteswap_uint64(x)

+#elif defined(__FreeBSD__)
+#include <sys/endian.h>
+#define bswap_32(x) bswap32(x)
+#define bswap_64(x) bswap64(x)
+
#elif defined(__APPLE__)

// Mac OS X / Darwin features


The system is:

FreeBSD kestrel 9.1-RELEASE FreeBSD 9.1-RELEASE #0 r244983: Thu Jan 3 09:27:01 PST 2013 root@kestrel:/usr/obj/usr/src/sys/GENERIC powerpc

g++ --version
g++ (GCC) 4.2.1 20070831 patched [FreeBSD]
Copyright (C) 2007 Free Software Foundation, Inc.


nicholas...@gmail.com

unread,
Jun 10, 2013, 12:47:51 PM6/10/13
to cityhash...@googlegroups.com, bri...@parc.com
M. Plass reports:

  "It appears that the portability problem lies in Hash32Len0to4().  It fetches through a const char *, but it is platform-dependent whether this is signed or unsigned.  I suspect the intent was unsigned, but the reference platform uses signed."

pikeg...@gmail.com

unread,
Jun 17, 2013, 4:06:19 PM6/17/13
to cityhash...@googlegroups.com, bri...@parc.com
Fixed, thanks.

Nick Briggs

unread,
Jun 17, 2013, 5:04:56 PM6/17/13
to cityhash...@googlegroups.com
Thank you. With this addition below it now compiles and passes the unit test on

FreeBSD 9.1-RELEASE-p3 #1 r250076: Tue Apr 30 00:56:21 PDT 2013 root@kestrel:/usr/obj/usr/src/sys/GENERIC powerpc

---------------
diff --git a/vendor/cityhash/src/city.cc b/vendor/cityhash/src/city.cc
index b9d244f..d01503b 100644
--- a/vendor/cityhash/src/city.cc
+++ b/vendor/cityhash/src/city.cc
@@ -69,6 +69,13 @@ static uint32 UNALIGNED_LOAD32(const char *p) {
#define bswap_64(x) bswap64(x)
#endif

+#elif defined(__FreeBSD__)
+
+// FreeBSD
+#include <sys/endian.h>
+#define bswap_32(x) bswap32(x)
+#define bswap_64(x) bswap64(x)
+
#else

#include <byteswap.h>
---------------

On Jun 17, 2013, at 1:06 PM, pikeg...@gmail.com wrote:

> Fixed, thanks.

Reply all
Reply to author
Forward
0 new messages