From 93aaf4fc94c7669391bd101755a1aba1573e5310 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 28 Oct 2016 17:07:29 -0700 Subject: [PATCH] Make CSerAction's ForRead() constexpr The CSerAction's ForRead() method does not depend on any runtime data, so guarantee that requests to it can be optimized out by making it constexpr. Suggested by Cory Fields. --- src/serialize.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/serialize.h b/src/serialize.h index 3b100481d..3b73c5cdf 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -879,11 +879,11 @@ void Unserialize(Stream& is, std::list& l) */ struct CSerActionSerialize { - bool ForRead() const { return false; } + constexpr bool ForRead() const { return false; } }; struct CSerActionUnserialize { - bool ForRead() const { return true; } + constexpr bool ForRead() const { return true; } }; template