HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SYS_VersionUtil.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SYS_VersionUtil.h (SYS Library, C++)
7  *
8  * COMMENTS: Version utility
9  */
10 
11 #ifndef __SYS_VERSIONUTIL_H_INCLUDED__
12 #define __SYS_VERSIONUTIL_H_INCLUDED__
13 
14 #include "SYS_API.h"
15 
16 /// Compare version numbers already split into components.
17 /// For strings, see UT_String::compareVersionString()
18 /// @{
19 static constexpr inline int
20 SYSversionCompare(int major1, int minor1, int build1,
21  int major2, int minor2, int build2)
22 {
23  if (major1 != major2)
24  return major1 - major2;
25  if (minor1 != minor2)
26  return minor1 - minor2;
27  if (build1 != build2)
28  return build1 - build2;
29  return 0;
30 }
31 
32 static constexpr inline int
33 SYSversionCompare(int major1, int minor1, int build1, int patch1,
34  int major2, int minor2, int build2, int patch2)
35 {
36  if (major1 != major2)
37  return major1 - major2;
38  if (minor1 != minor2)
39  return minor1 - minor2;
40  if (build1 != build2)
41  return build1 - build2;
42  if (patch1 != patch2)
43  return patch1 - patch2;
44  return 0;
45 }
46 /// @}
47 
48 #endif // __SYS_VERSIONUTIL_H_INCLUDED__