-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutils.h
More file actions
41 lines (36 loc) · 748 Bytes
/
utils.h
File metadata and controls
41 lines (36 loc) · 748 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
32
33
34
35
36
37
38
39
40
41
#ifndef UTILS_H_
#define UTILS_H_
#define CODE_SIZE 10
/**
* Convert a decimal number to base 4.
*
* @param decimal
* Decimal number.
*
* @return
* The given number converted to base 4.
*/
int base4(int decimal);
/**
* Convert a decimal number to a ten bits string.
*
* @param decimal
* The number to convert.
* @param buffer
* A buffer to save the string to.
*/
void base4code(long decimal, char* buffer);
/**
* Check if a character is either a space or a tab.
*
* @param c
* Character to check
* @return
* Non-zero if true.
*/
#define IsBlank(c) ((c) == ' ' || (c) == '\t')
/**
* Advance a string to the beginning of the next word.
*/
#define NextWord(x) while (IsBlank(*(x))) (x)++
#endif /* UTILS_H_ */