diff --git a/include/span.hpp b/include/span.hpp index 397887c..24de972 100644 --- a/include/span.hpp +++ b/include/span.hpp @@ -19,12 +19,16 @@ namespace hv inline T& operator[](std::size_t index) { +#ifdef DEBUG if (index>=len) throw "tried to index out of bounds of array"; +#endif return ptr[index]; } inline const T& operator[](std::size_t index) const { +#ifdef DEBUG if (index>=len) throw "tried to index out of bounds of array"; +#endif return ptr[index]; } diff --git a/src/hex.cpp b/src/hex.cpp index e32f543..3a0521d 100644 --- a/src/hex.cpp +++ b/src/hex.cpp @@ -69,19 +69,21 @@ namespace hv { #define S #endif fmt::print("0x{:016x} ", offset); + char hxbuf[3]; + std::size_t i=0; char ascii[1 + ROW_SZ]; + ascii[ROW_SZ] = 0; - std::size_t i=0; - char hxbuf[3]; hxbuf[2] = 0; for(;i