reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit ce83d97fcca065862aa559c5024374379754acfd
parent 785babf9f396615309b0307c1c28e5d76adb5e81
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Wed, 20 Apr 2016 02:03:24 -0400

store individual version segment in 16 bits, it's enough (up to 65535)

Diffstat:
Msrc/version.cpp | 6+++---
Msrc/version.hpp | 3++-
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/version.cpp b/src/version.cpp @@ -71,7 +71,7 @@ void Version::parse(const string &str) } else { try { - segments.push_back(boost::lexical_cast<uint64_t>(match)); + segments.push_back(boost::lexical_cast<Numeric>(match)); numeric++; } catch(const boost::bad_lexical_cast &) { @@ -206,11 +206,11 @@ int Version::compare(const Version &o) const for(size_t i = 0; i < biggest; i++) { const Segment &lseg = segment(i); - const uint64_t *lnum = boost::get<uint64_t>(&lseg); + const Numeric *lnum = boost::get<Numeric>(&lseg); const string *lstr = boost::get<string>(&lseg); const Segment &rseg = o.segment(i); - const uint64_t *rnum = boost::get<uint64_t>(&rseg); + const Numeric *rnum = boost::get<Numeric>(&rseg); const string *rstr = boost::get<string>(&rseg); if(lnum && rnum) { diff --git a/src/version.hpp b/src/version.hpp @@ -77,7 +77,8 @@ public: bool operator!=(const Version &o) const { return compare(o) != 0; } private: - typedef boost::variant<uint64_t, std::string> Segment; + typedef uint16_t Numeric; + typedef boost::variant<Numeric, std::string> Segment; Segment segment(size_t i) const;