Audacity
3.2.0
libraries
lib-string-utils
HexHelpers.h
Go to the documentation of this file.
1
#pragma once
2
3
/*!********************************************************************
4
5
Audacity: A Digital Audio Editor
6
7
@file HexHelpers.h
8
@brief Define helper functions for hex-to-num conversion.
9
10
Dmitry Vedenko
11
**********************************************************************/
12
13
#include <cstdint>
14
#include <cassert>
15
#include <cctype>
16
17
namespace
audacity
18
{
19
20
inline
uint8_t
HexCharToNum
(
char
c)
noexcept
21
{
22
assert (std::isxdigit (c) != 0);
23
24
if
(
'0'
<= c && c <=
'9'
)
25
return
c -
'0'
;
26
else
if
(
'A'
<= c && c <=
'F'
)
27
return
c -
'A'
+ 10;
28
else
if
(
'a'
<= c && c <=
'f'
)
29
return
c -
'a'
+ 10;
30
31
return
0;
32
}
33
34
}
audacity
Definition:
FileHistory.h:23
audacity::HexCharToNum
uint8_t HexCharToNum(char c) noexcept
Definition:
HexHelpers.h:20
Generated by
1.9.3