In order to solve the recurring overflow issues with the memory API, introduce a 128-bit integer type to hold sizes (range 0 - 2^64) and intermediates. While the patchset does reduce readability, I believe it is the only way to prevent overflows emerging in unlikely places in the code.
Avi Kivity (2): Add support for 128-bit arithmetic memory: use 128-bit integers for sizes and intermediates int128.h | 116 +++++++++++++++++++++++++++++++++++++ memory.c | 193 ++++++++++++++++++++++++++++++++++++-------------------------- memory.h | 3 +- 3 files changed, 231 insertions(+), 81 deletions(-) create mode 100644 int128.h -- 1.7.6.3