mdbx-test: fix int-types for 32-bit builds (minor).

Change-Id: Ib1ffe0633cf461e7881fe43953528688fe7abce0
This commit is contained in:
Leonid Yuriev 2018-08-22 07:22:01 +03:00 committed by Leo Yuriev
parent c362ad9465
commit 2791224542
3 changed files with 24 additions and 21 deletions

View File

@ -232,7 +232,7 @@ bool parse_option(int argc, char *const argv[], int &narg, const char *option,
bool parse_option(int argc, char *const argv[], int &narg, const char *option, bool parse_option(int argc, char *const argv[], int &narg, const char *option,
int64_t &value, const int64_t minval, const int64_t maxval, int64_t &value, const int64_t minval, const int64_t maxval,
const int64_t default_value) { const int64_t default_value) {
uint64_t proxy = (size_t)value; uint64_t proxy = (uint64_t)value;
if (parse_option(argc, argv, narg, option, proxy, config::binary, if (parse_option(argc, argv, narg, option, proxy, config::binary,
(uint64_t)minval, (uint64_t)maxval, (uint64_t)minval, (uint64_t)maxval,
(uint64_t)default_value)) { (uint64_t)default_value)) {
@ -245,7 +245,7 @@ bool parse_option(int argc, char *const argv[], int &narg, const char *option,
bool parse_option(int argc, char *const argv[], int &narg, const char *option, bool parse_option(int argc, char *const argv[], int &narg, const char *option,
int32_t &value, const int32_t minval, const int32_t maxval, int32_t &value, const int32_t minval, const int32_t maxval,
const int32_t default_value) { const int32_t default_value) {
uint64_t proxy = (size_t)value; uint64_t proxy = (uint64_t)value;
if (parse_option(argc, argv, narg, option, proxy, config::binary, if (parse_option(argc, argv, narg, option, proxy, config::binary,
(uint64_t)minval, (uint64_t)maxval, (uint64_t)minval, (uint64_t)maxval,
(uint64_t)default_value)) { (uint64_t)default_value)) {
@ -357,11 +357,12 @@ void dump(const char *title) {
: i->params.pathname_log.c_str()); : i->params.pathname_log.c_str());
} }
log_info( log_info("database: %s, size %" PRIuPTR "[%" PRIiPTR "..%" PRIiPTR
"database: %s, size %" PRIu64 "[%" PRIi64 "..%" PRIi64 ", %i %i, %i]\n", ", %i %i, %i]\n",
i->params.pathname_db.c_str(), i->params.size_now, i->params.size_lower, i->params.pathname_db.c_str(), i->params.size_now,
i->params.size_upper, i->params.shrink_threshold, i->params.growth_step, i->params.size_lower, i->params.size_upper,
i->params.pagesize); i->params.shrink_threshold, i->params.growth_step,
i->params.pagesize);
dump_verbs("mode", i->params.mode_flags, mode_bits); dump_verbs("mode", i->params.mode_flags, mode_bits);
dump_verbs("table", i->params.table_flags, table_bits); dump_verbs("table", i->params.table_flags, table_bits);

View File

@ -216,12 +216,12 @@ struct actor_params_pod {
unsigned mode_flags; unsigned mode_flags;
unsigned table_flags; unsigned table_flags;
int64_t size_lower; intptr_t size_lower;
int64_t size_now; intptr_t size_now;
int64_t size_upper; intptr_t size_upper;
int32_t shrink_threshold; int shrink_threshold;
int32_t growth_step; int growth_step;
int32_t pagesize; int pagesize;
unsigned test_duration; unsigned test_duration;
unsigned test_nops; unsigned test_nops;

View File

@ -173,15 +173,17 @@ int main(int argc, char *const argv[]) {
mdbx_limits_dbsize_min(params.pagesize), mdbx_limits_dbsize_min(params.pagesize),
mdbx_limits_dbsize_max(params.pagesize))) mdbx_limits_dbsize_max(params.pagesize)))
continue; continue;
if (config::parse_option(argc, argv, narg, "shrink-threshold", if (config::parse_option(
params.shrink_threshold, 0, argc, argv, narg, "shrink-threshold", params.shrink_threshold, 0,
mdbx_limits_dbsize_max(params.pagesize) - (int)std::min((intptr_t)INT_MAX,
mdbx_limits_dbsize_min(params.pagesize))) mdbx_limits_dbsize_max(params.pagesize) -
mdbx_limits_dbsize_min(params.pagesize))))
continue; continue;
if (config::parse_option(argc, argv, narg, "growth-step", if (config::parse_option(
params.growth_step, 0, argc, argv, narg, "growth-step", params.growth_step, 0,
mdbx_limits_dbsize_max(params.pagesize) - (int)std::min((intptr_t)INT_MAX,
mdbx_limits_dbsize_min(params.pagesize))) mdbx_limits_dbsize_max(params.pagesize) -
mdbx_limits_dbsize_min(params.pagesize))))
continue; continue;
if (config::parse_option(argc, argv, narg, "keygen.width", if (config::parse_option(argc, argv, narg, "keygen.width",