diff options
author | Siddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com> | 2025-03-22 11:00:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-22 11:00:14 -0400 |
commit | 4bad9ab29a5fa6c442a257974beb7daeaf91f046 (patch) | |
tree | 9386aa3ccd2302fceb9750858d74ab56f156b4e2 /inc/utils.h | |
parent | 82096f8cea42d78505b49d9f8ba22573daa2cc12 (diff) | |
parent | e73294467108f914debda39db2204c1f1493f8bf (diff) |
Merge pull request #29 from bdunahu/bdunahu
Small cleanups to up a lot of implementation details
Diffstat (limited to 'inc/utils.h')
-rw-r--r-- | inc/utils.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/inc/utils.h b/inc/utils.h index aa8831b..df8d374 100644 --- a/inc/utils.h +++ b/inc/utils.h @@ -20,6 +20,20 @@ void get_bit_fields(int address, int *tag, int *index, int *offset); */ const std::string string_format(const char *const zcFormat, ...); +/** + * Given `address`, returns an address that is within the current memory size + * using a clean wrap. + * @param an address + * @return an address guaranteed to be within range. + */ int wrap_address(int address); +/** + * Given `address`, returns the line and word it is in. + * @param an address + * @param the line (row) `address` is in + * @param the word (column) `address` corresponds to + */ +void get_memory_index(int address, int &line, int &word); + #endif /* UTILS_H_INCLUDED */ |