Merge pull request #16192 from maribu/tests/periph_ptp_clock

tests/periph_ptp_clock: fix bug in debug print
This commit is contained in:
Marian Buschsieweke 2021-03-20 06:51:31 +01:00 committed by GitHub
commit 654d841f66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,7 +67,8 @@ static int test_speed_adjustment(const int32_t speed)
print_str(" (~"); print_str(" (~");
{ {
int64_t tmp = speed * 100000ULL; int64_t tmp = speed * 100000ULL;
tmp /= UINT32_MAX; /* trusting compiler to use arithmetic right shift, when available instead of division */
tmp /= 1LL << 32;
tmp += 100000ULL; tmp += 100000ULL;
char output[16]; char output[16];
print(output, fmt_s32_dfp(output, (int32_t)tmp, -3)); print(output, fmt_s32_dfp(output, (int32_t)tmp, -3));