From 7f5cbf7dd847d7e68d634e83619852d206d6d378 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Wed, 7 Apr 2021 14:29:14 +0300 Subject: [PATCH] mdbx: avoid float-point ops in prev commit. Change-Id: I7fadc5096f49502c01a60436840bb1a87dfe27bd --- src/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core.c b/src/core.c index 0d4b7118..b8e64c6e 100644 --- a/src/core.c +++ b/src/core.c @@ -10529,8 +10529,7 @@ __cold static intptr_t get_reasonable_db_maxsize(intptr_t *cached_result) { assert(MAX_MAPSIZE >= (size_t)(total_ram_pages * pagesize * 2)); /* Suggesting should not be more than golden ratio of the size of RAM. */ - *cached_result = - (intptr_t)(total_ram_pages * pagesize * 1.6180339887498948482); + *cached_result = (intptr_t)((size_t)total_ram_pages * 207 >> 7) * pagesize; /* Round to the nearest human-readable granulation. */ for (int i = 10; i < MDBX_WORDBITS - 1; i += 10) {