From 6df91e4d1135dbf7247f5d8a47085a9804609800 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Fri, 27 Jan 2023 16:55:43 +0800 Subject: [PATCH] feat: add const `ALL_CASES_SIZE_SUM` --- src/klotski/all_cases/all_cases.h | 4 ++++ src/klotski/ffi/tmain.cc | 4 ++++ test/all_cases.cc | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/klotski/all_cases/all_cases.h b/src/klotski/all_cases/all_cases.h index 6e83cc3..8a94bd2 100644 --- a/src/klotski/all_cases/all_cases.h +++ b/src/klotski/all_cases/all_cases.h @@ -27,6 +27,7 @@ #include #include #include +#include #include "basic_ranges.h" namespace klotski { @@ -37,6 +38,9 @@ namespace klotski { 2322050, 1876945, 2322050, 0, 2942906, 2260392, 2942906, 0, }; + const uint32_t ALL_CASES_SIZE_SUM = std::accumulate( // aka 29334498 + ALL_CASES_SIZE, ALL_CASES_SIZE + 16, (uint32_t)0 + ); class AllCases : public BasicRanges { public: diff --git a/src/klotski/ffi/tmain.cc b/src/klotski/ffi/tmain.cc index fad95b3..ea2c7fb 100644 --- a/src/klotski/ffi/tmain.cc +++ b/src/klotski/ffi/tmain.cc @@ -9,11 +9,15 @@ #include "common.h" #include "benchmark.h" +#include "all_cases.h" + using namespace klotski; void tmain() { printf("tmain start\n"); + std::cout << ALL_CASES_SIZE_SUM << std::endl; + // uint64_t common_code = 0x1A9BC0C00; // klotski::Common::range_reverse(common_code); diff --git a/test/all_cases.cc b/test/all_cases.cc index 5153091..37aa211 100644 --- a/test/all_cases.cc +++ b/test/all_cases.cc @@ -7,12 +7,12 @@ using klotski::AllCases; using klotski::BasicRanges; using klotski::ALL_CASES_SIZE; using klotski::BASIC_RANGES_SIZE; +using klotski::ALL_CASES_SIZE_SUM; /// basic ranges constants const char BASIC_RANGES_MD5[] = "6f385dc171e201089ff96bb010b47212"; /// all cases constants -const uint32_t ALL_CASES_SIZE_SUM = 29334498; const char ALL_CASES_MD5[] = "3888e9fab8d3cbb50908b12b147cfb23"; /// basic ranges size check