From fdca04db6850273157e3c50de476e0b9298e9948 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 3 May 2015 10:09:57 +0200 Subject: [PATCH] cmPolicies: Implement more-compact IsPolicyNewerThan. --- Source/cmPolicies.cxx | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 6a159655b..9250620c2 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -80,23 +80,12 @@ public: unsigned int minorV, unsigned int patchV) { - if (majorV < this->MajorVersionIntroduced) - { - return true; - } - if (majorV > this->MajorVersionIntroduced) - { - return false; - } - if (minorV < this->MinorVersionIntroduced) - { - return true; - } - if (minorV > this->MinorVersionIntroduced) - { - return false; - } - return (patchV < this->PatchVersionIntroduced); + return (majorV < this->MajorVersionIntroduced || + (majorV == this->MajorVersionIntroduced && + minorV < this->MinorVersionIntroduced) || + (majorV == this->MajorVersionIntroduced && + minorV == this->MinorVersionIntroduced && + patchV < this->PatchVersionIntroduced)); } cmPolicies::PolicyID ID;