diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/utils.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/utils.cc b/src/utils/utils.cc index 3a99cec..b5a4d55 100644 --- a/src/utils/utils.cc +++ b/src/utils/utils.cc @@ -28,3 +28,10 @@ const std::string string_format(const char *const zcFormat, ...) va_end(vaArgs); return std::string(zc.data(), iLen); } + +int wrap_address(int address) { + if (address < 0){ + return ((address % MEM_SIZE) + MEM_SIZE) % MEM_SIZE; + } + return address % MEM_SIZE; +} |