summaryrefslogtreecommitdiff
path: root/inc/utils.h
blob: aa8831bec4dd9c7dba4a80fe6461e7895f7126d5 (plain)
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
#ifndef UTILS_H
#define UTILS_H
#include <string>

/**
 * Parse an address into a tag, index into the cache table, and a line
 * offset.
 * @param the address to be parsed
 * @param the resulting tag
 * @param the resulting index
 * @param the resulting offset
 */
void get_bit_fields(int address, int *tag, int *index, int *offset);

/**
 * Formats a string using snprintf.
 * @param an object that represents the format string
 * @param arguments to be formatted
 * @return a string object holding the formatted result
 */
const std::string string_format(const char *const zcFormat, ...);

int wrap_address(int address);

#endif /* UTILS_H_INCLUDED */