Skip to content

Commit 19d97d3

Browse files
Auto-generate files after cl/732252827
1 parent d18a224 commit 19d97d3

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

php/ext/google/protobuf/php-upb.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11701,6 +11701,7 @@ _upb_DefPool_Init google_protobuf_descriptor_proto_upbdefinit = {
1170111701
* Implementation is heavily inspired by Lua's ltable.c.
1170211702
*/
1170311703

11704+
#include <stdint.h>
1170411705
#include <string.h>
1170511706

1170611707

@@ -11762,7 +11763,14 @@ typedef bool eqlfunc_t(upb_tabkey k1, lookupkey_t k2);
1176211763

1176311764
/* Base table (shared code) ***************************************************/
1176411765

11765-
static uint32_t upb_inthash(uintptr_t key) { return (uint32_t)key; }
11766+
static uint32_t upb_inthash(uintptr_t key) {
11767+
if (sizeof(uintptr_t) == 8) {
11768+
return (uint32_t)key ^ (uint32_t)(key >> 32);
11769+
} else {
11770+
UPB_ASSERT(sizeof(uintptr_t) == 4);
11771+
return (uint32_t)key;
11772+
}
11773+
}
1176611774

1176711775
static const upb_tabent* upb_getentry(const upb_table* t, uint32_t hash) {
1176811776
return t->entries + (hash & t->mask);

ruby/ext/google/protobuf_c/ruby-upb.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11177,6 +11177,7 @@ const upb_MiniTableFile google_protobuf_descriptor_proto_upb_file_layout = {
1117711177
* Implementation is heavily inspired by Lua's ltable.c.
1117811178
*/
1117911179

11180+
#include <stdint.h>
1118011181
#include <string.h>
1118111182

1118211183

@@ -11238,7 +11239,14 @@ typedef bool eqlfunc_t(upb_tabkey k1, lookupkey_t k2);
1123811239

1123911240
/* Base table (shared code) ***************************************************/
1124011241

11241-
static uint32_t upb_inthash(uintptr_t key) { return (uint32_t)key; }
11242+
static uint32_t upb_inthash(uintptr_t key) {
11243+
if (sizeof(uintptr_t) == 8) {
11244+
return (uint32_t)key ^ (uint32_t)(key >> 32);
11245+
} else {
11246+
UPB_ASSERT(sizeof(uintptr_t) == 4);
11247+
return (uint32_t)key;
11248+
}
11249+
}
1124211250

1124311251
static const upb_tabent* upb_getentry(const upb_table* t, uint32_t hash) {
1124411252
return t->entries + (hash & t->mask);

0 commit comments

Comments
 (0)