-
Notifications
You must be signed in to change notification settings - Fork 1
/
rwc_nst_test_version.h
58 lines (45 loc) · 1.17 KB
/
rwc_nst_test_version.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
Module: rwc_nst_test_version.h
Function:
Version for rwc_nst_test
Copyright notice and License:
See LICENSE file accompanying this project.
Author:
Terry Moore, MCCI Corporation 2019
*/
#ifndef _rwc_nst_test_version_h_
# define _rwc_nst_test_version_h_
#pragma once
// create a version number for comparison
static constexpr std::uint32_t
makeVersion(
std::uint8_t major, std::uint8_t minor, std::uint8_t patch, std::uint8_t local = 0
)
{
return ((std::uint32_t)major << 24u) | ((std::uint32_t)minor << 16u) | ((std::uint32_t)patch << 8u) | (std::uint32_t)local;
}
// extract major number from version
static constexpr std::uint8_t
getMajor(std::uint32_t v)
{
return std::uint8_t(v >> 24u);
}
// extract minor number from version
static constexpr std::uint8_t
getMinor(std::uint32_t v)
{
return std::uint8_t(v >> 16u);
}
// extract patch number from version
static constexpr std::uint8_t
getPatch(std::uint32_t v)
{
return std::uint8_t(v >> 8u);
}
// extract local number from version
static constexpr std::uint8_t
getLocal(std::uint32_t v)
{
return std::uint8_t(v);
}
#endif // _rwc_nst_test_version_h_