From 7d52d7bef81bee3d07e33394c30eb462d3eb4bf9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 13 Jul 2018 09:49:53 -0400 Subject: [PATCH] inst_gen: Compress loop into std::any_of in IsInvalidInstruction() Same behavior, but using a more self-documenting function. --- tests/A64/inst_gen.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/A64/inst_gen.h b/tests/A64/inst_gen.h index 64316d84..b3a9928f 100644 --- a/tests/A64/inst_gen.h +++ b/tests/A64/inst_gen.h @@ -4,6 +4,7 @@ * General Public License version 2 or any later version. */ +#include #include #include @@ -23,10 +24,8 @@ public: } static bool IsInvalidInstruction(u32 inst) { - for (const auto& invalid : invalid_instructions) - if (invalid.Match(inst)) - return true; - return false; + return std::any_of(invalid_instructions.begin(), invalid_instructions.end(), + [inst](const auto& invalid) { return invalid.Match(inst); }); } private: