diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 21:43:46 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 21:43:46 +0100 |
| commit | 3fe8ee352845741d97a76e2ed6a390cb1481d755 (patch) | |
| tree | 92f43538f1094130676a2be5ffa4879586db3cb7 /test | |
| parent | 1880ccb6d85c6eb79e724593457877bab431951c (diff) | |
minor changes
Diffstat (limited to 'test')
| -rw-r--r-- | test/other/josephus2.cpp | 2 | ||||
| -rw-r--r-- | test/util.h | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/test/other/josephus2.cpp b/test/other/josephus2.cpp index c6b1cd1..f2c0440 100644 --- a/test/other/josephus2.cpp +++ b/test/other/josephus2.cpp @@ -15,7 +15,7 @@ void stress_test() { ll tests = 0; for (ll i = 1; i < 2'000; i++) { auto got = rotateLeft(i); - auto expected = naive<1>(i, 2); + auto expected = naive<0>(i, 2); if (got != expected) cerr << "error: " << i << FAIL; tests++; } diff --git a/test/util.h b/test/util.h index 0c14ff8..e0d9b57 100644 --- a/test/util.h +++ b/test/util.h @@ -10,6 +10,14 @@ namespace INT {constexpr int INF = 0x3FFF'FFFF;} namespace LL {constexpr ll INF = 0x3FFF'FFFF'FFFF'FFFFll;} namespace LD {constexpr ld INF = numeric_limits<ld>::infinity();} +template<typename T> +T _lg_check(T n) { + assert(n > 0); + return __lg(n); +} + +#define __lg _lg_check + namespace details { template<typename T = ll> bool isPrime(T x) { |
