-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHex_Util.h
48 lines (31 loc) · 1.04 KB
/
Hex_Util.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Created by Eshin Griffith on 11/3/17.
//
/* Hex_Util contains functions for converting between hex, binary, and decimal respectively.
* All of the names should be intuitive.
*/
#ifndef PHASE_2_HEX_UTIL_H
#define PHASE_2_HEX_UTIL_H
#include<string>
#include <vector>
namespace Hex_Util {
// Hex to Binary
std::string hex_to_binary(std::string hex_input); //converts Hex values to 32-bit binary long
std::string hex_char_to_binary(char hex);
// Hex to Decimal
int hex_to_decimal(std::string hex_input);
int hex_char_to_decimal(char hexChar);
// Binary to Hex
std::string binary_to_hex(std::string bin_input);
char four_bits_to_hex(std::string binary);
// Binary to Decimal
int binary_to_decimal(std::string bin_input);
// Decimal to Binary
// Decimal to Hex (string)
std::string decimal_to_hex(int decimalInput);
// String to decimal
std::string bool_to_string(bool s);
// Parsing
std::vector<int> parseIntsFromString(std::string temp);
};
#endif //PHASE_2_HEX_UTIL_H