From 0ea9b42db84560f795e6d017a799b0e536c96cd7 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 25 Jan 2021 07:58:49 -0800 Subject: [PATCH] clear high-bit when generating gameIDs postgres DB, at least on ARM, doesn't like it. --- xwords4/common/game.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xwords4/common/game.c b/xwords4/common/game.c index 06b7bc223..14c8e28fb 100644 --- a/xwords4/common/game.c +++ b/xwords4/common/game.c @@ -84,6 +84,9 @@ makeGameID( XW_UtilCtxt* util ) while ( 0 == gameID ) { /* High bit never set by XP_RANDOM() alone */ gameID = (XP_RANDOM() << 16) ^ XP_RANDOM(); + /* But let's clear it -- set high-bit causes problems for existing + postgres DB where INTEGER is apparently a signed 32-bit */ + gameID &= 0x7FFFFFFF; } LOG_RETURNF( "%x/%d", gameID, gameID ); return gameID;