From ac4dbd3b25f022b3ef025f6d3451712187308efb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 15 Oct 2019 14:47:42 -0400 Subject: [PATCH 1/2] common: Rename binary_find.h to algorithm.h Makes the header more general for other potential algorithms in the future. While we're at it, include a missing include to satisfy the use of std::less. --- src/common/CMakeLists.txt | 2 +- src/common/{binary_find.h => algorithm.h} | 1 + src/video_core/texture_cache/surface_base.cpp | 1 + src/video_core/texture_cache/surface_base.h | 5 ++--- 4 files changed, 5 insertions(+), 4 deletions(-) rename src/common/{binary_find.h => algorithm.h} (96%) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 906c486fd..5b51fcafa 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -95,11 +95,11 @@ add_custom_command(OUTPUT scm_rev.cpp ) add_library(common STATIC + algorithm.h alignment.h assert.h detached_tasks.cpp detached_tasks.h - binary_find.h bit_field.h bit_util.h cityhash.cpp diff --git a/src/common/binary_find.h b/src/common/algorithm.h similarity index 96% rename from src/common/binary_find.h rename to src/common/algorithm.h index 5cc523bf9..18e7ece98 100644 --- a/src/common/binary_find.h +++ b/src/common/algorithm.h @@ -5,6 +5,7 @@ #pragma once #include +#include namespace Common { diff --git a/src/video_core/texture_cache/surface_base.cpp b/src/video_core/texture_cache/surface_base.cpp index 683c49207..829268b4c 100644 --- a/src/video_core/texture_cache/surface_base.cpp +++ b/src/video_core/texture_cache/surface_base.cpp @@ -2,6 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/algorithm.h" #include "common/assert.h" #include "common/common_types.h" #include "common/microprofile.h" diff --git a/src/video_core/texture_cache/surface_base.h b/src/video_core/texture_cache/surface_base.h index 5e497e49f..1bed82898 100644 --- a/src/video_core/texture_cache/surface_base.h +++ b/src/video_core/texture_cache/surface_base.h @@ -4,12 +4,11 @@ #pragma once -#include +#include +#include #include #include -#include "common/assert.h" -#include "common/binary_find.h" #include "common/common_types.h" #include "video_core/gpu.h" #include "video_core/morton.h" From d5706346d7e95984a003bfeedf1b8ffed6dd9422 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 15 Oct 2019 14:56:15 -0400 Subject: [PATCH 2/2] common/algorithm: Add description comment indicating intended algorithms Makes it explicit that the header is intended for iterator-based algorithms that can ideally operate on any type. --- src/common/algorithm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/algorithm.h b/src/common/algorithm.h index 18e7ece98..e21b1373c 100644 --- a/src/common/algorithm.h +++ b/src/common/algorithm.h @@ -7,6 +7,11 @@ #include #include +// Algorithms that operate on iterators, much like the header. +// +// Note: If the algorithm is not general-purpose and/or doesn't operate on iterators, +// it should probably not be placed within this header. + namespace Common { template >