rocprofiler-sdk/cxx/version.hpp Source File# ROCprofiler-SDK developer API: rocprofiler-sdk/cxx/version.hpp Source File ROCprofiler-SDK developer API 1.0.0 ROCm Profiling API and tools rocprofiler-sdkcxx version.hpp 1// MIT License 2// 3// Copyright (c) 2023-2025 Advanced Micro Devices, Inc. All rights reserved. 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to deal 7// in the Software without restriction, including without limitation the rights 8// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9// copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in all 13// copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21// SOFTWARE. 22// 23 24#pragma once 25 26#include <rocprofiler-sdk/fwd.h> 27 28#include <cstdint> 29 30namespace rocprofiler 31{ 32namespace sdk 33{ 34namespace version 35{ 36/** 37 * @brief This function extracts the `<major>.<minor>.<patch>` from a single integer which encodes 38 * this triplet by a factor of `N`. E.g. version 3.2.1 using N=100 is represented by the value of 39 * 30201; version 3.2.1 using N=1000 is represented by the value of 3002001. 40 * 41 * For a given factor `N`, the major version can be extracted by 42 * dividing the version value by (N * N); the minor version can be extracted via 43 * computing the modulus of (N * N) and then divided by N; the patch version is simply the modulus 44 * of N. 45 */ 46template <uint64_t FactorV = 100> 47constexpr rocprofiler_version_triplet_t 48compute_version_triplet(uint64_t version) 49{ 50 constexpr auto factor = FactorV; 51 52 return rocprofiler_version_triplet_t{ 53 .major = static_cast<uint32_t>(version / (factor * factor)), 54 .minor = static_cast<uint32_t>((version % (factor * factor)) / factor), 55 .patch = static_cast<uint32_t>(version % factor)}; 56} 57} // namespace version 58} // namespace sdk 59} // namespace rocprofiler rocprofiler_version_triplet_tVersioning info.Definition fwd.h:590 Generated by 1.9.8