From 707a7ce38f97a782d0fc7fdbc033c16b146b9809 Mon Sep 17 00:00:00 2001 From: twosee Date: Mon, 27 Apr 2020 17:01:05 +0800 Subject: [PATCH] Fix 32-bit build (#3276) (#3277) --- include/swoole.h | 4 ++++ swoole_table.cc | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/swoole.h b/include/swoole.h index e6facb100..2dcef076e 100644 --- a/include/swoole.h +++ b/include/swoole.h @@ -104,6 +104,10 @@ int clock_gettime(clock_id_t which_clock, struct timespec *t); #endif typedef unsigned long ulong_t; +#ifndef PRId64 +#define PRId64 "lld" +#endif + #ifndef PRIu64 #define PRIu64 "llu" #endif diff --git a/swoole_table.cc b/swoole_table.cc index c3b055b35..d07818ee5 100644 --- a/swoole_table.cc +++ b/swoole_table.cc @@ -393,7 +393,7 @@ PHP_METHOD(swoole_table, __construct) zend_throw_exception(swoole_exception_ce, "global memory allocation failure", SW_ERROR_MALLOC_FAIL); RETURN_FALSE; } - table->hash_func = [](const char *key, size_t len) { + table->hash_func = [](const char *key, size_t len) -> uint64_t { zend_string *string = (zend_string *) (key - offsetof(zend_string, val)); return zend_string_hash_val(string); };