lokinet/llarp/util/encode.cpp

19 lines
340 B
C++
Raw Normal View History

#include <util/encode.hpp>
2018-06-21 11:13:40 +00:00
#include <stdexcept>
2018-06-21 11:11:55 +00:00
2018-06-21 11:13:40 +00:00
namespace llarp
2018-06-21 11:11:55 +00:00
{
int
char2int(char input)
2018-06-21 11:13:40 +00:00
{
if(input >= '0' && input <= '9')
return input - '0';
if(input >= 'A' && input <= 'F')
return input - 'A' + 10;
if(input >= 'a' && input <= 'f')
return input - 'a' + 10;
2018-09-04 19:15:06 +00:00
return 0;
2018-06-21 11:13:40 +00:00
}
2018-07-09 03:34:29 +00:00
} // namespace llarp