diff options
author | bd <bdunahu@operationnull.com> | 2025-03-11 17:24:37 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-11 17:24:37 -0400 |
commit | 282aff5a3d1b6f9678453dfa3e216849d5b1d954 (patch) | |
tree | 4de529c2e8a762503b99db77efc73cdc98104bb0 /src/utils/utils.cc | |
parent | def2338f8156281e776ec5d60769c3e64b88e65d (diff) | |
parent | f208e63ce553c6144a672cd35da23425fa7f86d1 (diff) |
Merge remote-tracking branch 'origin/master' into bdunahu
Diffstat (limited to 'src/utils/utils.cc')
-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; +} |