mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-21 18:18:21 +08:00
mdbx: more minor fixes 32-to-64 warnings from Apple's CLANG 13.
This commit is contained in:
parent
a8d3007e61
commit
5d2eb580fd
@ -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);
|
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)
|
if (!space_id_cstr || strcmp(space_id_cstr, "auto") == 0)
|
||||||
space_id = last_space_id + 1;
|
space_id = last_space_id + 1;
|
||||||
else {
|
else {
|
||||||
@ -79,13 +79,13 @@ void configure_actor(unsigned &last_space_id, const actor_testcase testcase,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!registry::review_actor_params(testcase, params))
|
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)
|
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;
|
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));
|
testcase2str(testcase));
|
||||||
global::actors.emplace_back(
|
global::actors.emplace_back(
|
||||||
actor_config(testcase, params, space_id, wait4id));
|
actor_config(testcase, params, space_id, wait4id));
|
||||||
|
@ -26,11 +26,11 @@ uint32_t ns2fractional(uint32_t ns) {
|
|||||||
* для ясности кода оставлено как есть (без ручной оптимизации). Так как
|
* для ясности кода оставлено как есть (без ручной оптимизации). Так как
|
||||||
* GCC, Clang и даже MSVC сами давно умеют конвертировать деление на
|
* GCC, Clang и даже MSVC сами давно умеют конвертировать деление на
|
||||||
* константу в быструю reciprocal-форму. */
|
* константу в быструю 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) {
|
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
|
#ifndef USEC_PER_SEC
|
||||||
@ -38,11 +38,11 @@ uint32_t fractional2ns(uint32_t fractional) {
|
|||||||
#endif /* USEC_PER_SEC */
|
#endif /* USEC_PER_SEC */
|
||||||
uint32_t us2fractional(uint32_t us) {
|
uint32_t us2fractional(uint32_t us) {
|
||||||
assert(us < USEC_PER_SEC);
|
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) {
|
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
|
#ifndef MSEC_PER_SEC
|
||||||
@ -50,31 +50,31 @@ uint32_t fractional2us(uint32_t fractional) {
|
|||||||
#endif /* MSEC_PER_SEC */
|
#endif /* MSEC_PER_SEC */
|
||||||
uint32_t ms2fractional(uint32_t ms) {
|
uint32_t ms2fractional(uint32_t ms) {
|
||||||
assert(ms < MSEC_PER_SEC);
|
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) {
|
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 from_ns(uint64_t ns) {
|
||||||
time result;
|
time result;
|
||||||
result.fixedpoint = ((ns / NSEC_PER_SEC) << 32) |
|
result.fixedpoint =
|
||||||
ns2fractional((uint32_t)(ns % NSEC_PER_SEC));
|
((ns / NSEC_PER_SEC) << 32) | ns2fractional(uint32_t(ns % NSEC_PER_SEC));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
time from_us(uint64_t us) {
|
time from_us(uint64_t us) {
|
||||||
time result;
|
time result;
|
||||||
result.fixedpoint = ((us / USEC_PER_SEC) << 32) |
|
result.fixedpoint =
|
||||||
us2fractional((uint32_t)(us % USEC_PER_SEC));
|
((us / USEC_PER_SEC) << 32) | us2fractional(uint32_t(us % USEC_PER_SEC));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
time from_ms(uint64_t ms) {
|
time from_ms(uint64_t ms) {
|
||||||
time result;
|
time result;
|
||||||
result.fixedpoint = ((ms / MSEC_PER_SEC) << 32) |
|
result.fixedpoint =
|
||||||
ms2fractional((uint32_t)(ms % MSEC_PER_SEC));
|
((ms / MSEC_PER_SEC) << 32) | ms2fractional(uint32_t(ms % MSEC_PER_SEC));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user