aboutsummaryrefslogtreecommitdiff
path: root/libbutl/standard-version.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-12-18 14:17:55 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-01-06 20:55:07 +0300
commit6876fd23ef84487c016e7be46d3deb7d1e695cef (patch)
tree4ea4cf65e129a79f2d7a82489228c67e85d3e034 /libbutl/standard-version.ixx
parent3bf1846063ad30ecc0fc90d34490bf70776faef0 (diff)
Fix standard_version constructors
Diffstat (limited to 'libbutl/standard-version.ixx')
-rw-r--r--libbutl/standard-version.ixx17
1 files changed, 11 insertions, 6 deletions
diff --git a/libbutl/standard-version.ixx b/libbutl/standard-version.ixx
index c488284..66dccba 100644
--- a/libbutl/standard-version.ixx
+++ b/libbutl/standard-version.ixx
@@ -70,6 +70,9 @@ namespace butl
return version % 10000 == 1 && !snapshot () && !stub ();
}
+ // Note: in the following constructors we subtract one from AAABBBCCC if
+ // DDDE is not zero (see standard-version.hxx for details).
+ //
inline standard_version::
standard_version (std::uint16_t ep,
std::uint16_t mj,
@@ -82,7 +85,8 @@ namespace butl
(mj * 10000000000ULL +
mi * 10000000ULL +
pa * 10000ULL +
- pr * 10ULL),
+ pr * 10ULL -
+ (pr != 0 ? 10000ULL : 0ULL)),
"" /* snapshot */,
rv)
{
@@ -99,11 +103,12 @@ namespace butl
std::uint16_t rv)
: standard_version (ep,
// AAABBBCCCDDDE
- (mj * 10000000000ULL +
- mi * 10000000ULL +
- pa * 10000ULL +
- pr * 10ULL +
- /**/ 1ULL /* snapshot */),
+ (mj * 10000000000ULL +
+ mi * 10000000ULL +
+ pa * 10000ULL +
+ pr * 10ULL +
+ 1ULL /* snapshot */ -
+ 10000ULL),
sn,
si,
rv)