diff --git a/modules/10_cpp14/src/digit_separators.cpp b/modules/10_cpp14/src/digit_separators.cpp index b3babbe..e3498ee 100644 --- a/modules/10_cpp14/src/digit_separators.cpp +++ b/modules/10_cpp14/src/digit_separators.cpp @@ -3,18 +3,20 @@ namespace cpp14 { auto million() -> int { - // TODO: Return 1'000'000 using digit separators - return 0; + return 1'000'000; } auto mask() -> std::uint32_t { - // TODO: Return 0xFF00'00FF - return 0; + return 0xFF00'00FF; } auto bits_set() -> int { - // TODO: Return population count of mask() - return 0; + const auto m = mask(); + auto count = 0; + for (auto i = 0; i < 32; i++) { + if (m & (1 << i)) ++count; + } + return count; } } // namespace cpp14