• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef INCLUDE_BASE_NUMERICAL_TO_STRING_H
16 #define INCLUDE_BASE_NUMERICAL_TO_STRING_H
17 #include <string>
18 #include "string_to_numerical.h"
19 #include "ts_common.h"
20 
21 namespace SysTuning {
22 namespace base {
23 // Put uint_ 64 type numbers are converted to hexadecimal numbers and expressed as strings.
Uint64ToHexText(uint64_t inputNumber)24 inline std::string Uint64ToHexText(uint64_t inputNumber)
25 {
26     if (inputNumber == INVALID_UINT64) {
27         return "";
28     }
29     std::string str = "0x" + base::number(inputNumber, base::INTEGER_RADIX_TYPE_HEX);
30     return str;
31 }
32 } // namespace base
33 } // namespace SysTuning
34 
35 #endif // INCLUDE_BASE_NUMERICAL_TO_STRING_H_
36