forked from nayuki/Bitcoin-Cryptography-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.cpp
More file actions
31 lines (24 loc) · 636 Bytes
/
Copy pathUtils.cpp
File metadata and controls
31 lines (24 loc) · 636 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* Bitcoin cryptography library
* Copyright (c) Project Nayuki
*
* https://www.nayuki.io/page/bitcoin-cryptography-library
* https://github.com/nayuki/Bitcoin-Cryptography-Library
*/
#include <cstring>
#include "Utils.hpp"
int Utils::parseHexDigit(int ch) {
if ('0' <= ch && ch <= '9')
return ch - '0';
else if ('a' <= ch && ch <= 'f')
return ch - 'a' + 10;
else if ('A' <= ch && ch <= 'F')
return ch - 'A' + 10;
else
return -1;
}
void Utils::copyBytes(void *dest, const void *src, std::size_t count) {
if (count > 0)
std::memmove(dest, src, count);
}
const char *Utils::HEX_DIGITS = "0123456789abcdef";