style: add clang-format config and reformat scaffolding files

This commit is contained in:
2026-09-07 10:07:26 +02:00
parent 975e3b2974
commit 50369995c7
12 changed files with 100 additions and 64 deletions
+8 -8
View File
@@ -3,18 +3,18 @@
#include <cassert>
#include <cstdint>
int main () {
assert ( sc::rtp_timestamp_from_ns ( 0 ) == 0u );
assert ( sc::rtp_timestamp_from_ns ( 1'000'000'000ULL ) == 90'000u );
assert ( sc::rtp_timestamp_from_ns ( 500'000'000ULL ) == 45'000u );
assert ( sc::rtp_timestamp_from_ns ( 16'666'667ULL ) == 1'500u );
int main() {
assert(sc::rtp_timestamp_from_ns(0) == 0u);
assert(sc::rtp_timestamp_from_ns(1'000'000'000ULL) == 90'000u);
assert(sc::rtp_timestamp_from_ns(500'000'000ULL) == 45'000u);
assert(sc::rtp_timestamp_from_ns(16'666'667ULL) == 1'500u);
// A multiple of the wrap period should wrap back to zero.
// Period in ns = ceil(2^32 * 100_000 / 9) because the helper uses
// integer floor division (ns * 9 / 100_000).
constexpr uint64_t period_ns = ( ( 1ULL << 32 ) * 100'000ULL + 9ULL - 1ULL ) / 9ULL;
static_assert ( sc::rtp_timestamp_from_ns ( period_ns ) == 0u );
static_assert ( sc::rtp_timestamp_from_ns ( period_ns + 1'000'000'000ULL ) == 90'000u );
constexpr uint64_t period_ns = ((1ULL << 32) * 100'000ULL + 9ULL - 1ULL) / 9ULL;
static_assert(sc::rtp_timestamp_from_ns(period_ns) == 0u);
static_assert(sc::rtp_timestamp_from_ns(period_ns + 1'000'000'000ULL) == 90'000u);
return 0;
}