mdbx: more minor fixes 32-to-64 warnings from Apple's CLANG 13.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-05-19 13:11:25 +03:00
parent a8d3007e61
commit 5d2eb580fd
2 changed files with 16 additions and 16 deletions

View File

@ -65,7 +65,7 @@ void configure_actor(unsigned &last_space_id, const actor_testcase testcase,
failure("No previous waitable actor for %u-ops\n", params.waitfor_nops);
}
unsigned space_id = 0;
unsigned long space_id = 0;
if (!space_id_cstr || strcmp(space_id_cstr, "auto") == 0)
space_id = last_space_id + 1;
else {
@ -79,13 +79,13 @@ void configure_actor(unsigned &last_space_id, const actor_testcase testcase,
}
if (!registry::review_actor_params(testcase, params))
failure("Actor config-review failed for space-id %u\n", space_id);
failure("Actor config-review failed for space-id %lu\n", space_id);
if (space_id > ACTOR_ID_MAX)
failure("Invalid space-id %u\n", space_id);
failure("Invalid space-id %lu\n", space_id);
last_space_id = space_id;
log_trace("configure_actor: space %u for %s", space_id,
log_trace("configure_actor: space %lu for %s", space_id,
testcase2str(testcase));
global::actors.emplace_back(
actor_config(testcase, params, space_id, wait4id));

View File

@ -26,11 +26,11 @@ uint32_t ns2fractional(uint32_t ns) {
* для ясности кода оставлено как есть (без ручной оптимизации). Так как
* GCC, Clang и даже MSVC сами давно умеют конвертировать деление на
* константу в быструю reciprocal-форму. */
return ((uint64_t)ns << 32) / NSEC_PER_SEC;
return uint32_t((uint64_t(ns) << 32) / NSEC_PER_SEC);
}
uint32_t fractional2ns(uint32_t fractional) {
return (fractional * (uint64_t)NSEC_PER_SEC) >> 32;
return uint32_t((fractional * uint64_t(NSEC_PER_SEC)) >> 32);
}
#ifndef USEC_PER_SEC
@ -38,11 +38,11 @@ uint32_t fractional2ns(uint32_t fractional) {
#endif /* USEC_PER_SEC */
uint32_t us2fractional(uint32_t us) {
assert(us < USEC_PER_SEC);
return ((uint64_t)us << 32) / USEC_PER_SEC;
return uint32_t((uint64_t(us) << 32) / USEC_PER_SEC);
}
uint32_t fractional2us(uint32_t fractional) {
return (fractional * (uint64_t)USEC_PER_SEC) >> 32;
return uint32_t((fractional * uint64_t(USEC_PER_SEC)) >> 32);
}
#ifndef MSEC_PER_SEC
@ -50,31 +50,31 @@ uint32_t fractional2us(uint32_t fractional) {
#endif /* MSEC_PER_SEC */
uint32_t ms2fractional(uint32_t ms) {
assert(ms < MSEC_PER_SEC);
return ((uint64_t)ms << 32) / MSEC_PER_SEC;
return uint32_t((uint64_t(ms) << 32) / MSEC_PER_SEC);
}
uint32_t fractional2ms(uint32_t fractional) {
return (fractional * (uint64_t)MSEC_PER_SEC) >> 32;
return uint32_t((fractional * uint64_t(MSEC_PER_SEC)) >> 32);
}
time from_ns(uint64_t ns) {
time result;
result.fixedpoint = ((ns / NSEC_PER_SEC) << 32) |
ns2fractional((uint32_t)(ns % NSEC_PER_SEC));
result.fixedpoint =
((ns / NSEC_PER_SEC) << 32) | ns2fractional(uint32_t(ns % NSEC_PER_SEC));
return result;
}
time from_us(uint64_t us) {
time result;
result.fixedpoint = ((us / USEC_PER_SEC) << 32) |
us2fractional((uint32_t)(us % USEC_PER_SEC));
result.fixedpoint =
((us / USEC_PER_SEC) << 32) | us2fractional(uint32_t(us % USEC_PER_SEC));
return result;
}
time from_ms(uint64_t ms) {
time result;
result.fixedpoint = ((ms / MSEC_PER_SEC) << 32) |
ms2fractional((uint32_t)(ms % MSEC_PER_SEC));
result.fixedpoint =
((ms / MSEC_PER_SEC) << 32) | ms2fractional(uint32_t(ms % MSEC_PER_SEC));
return result;
}