improve span

master v1.0.2
Avril 4 years ago
parent 3aaf09031e
commit 96795c0f91
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -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];
}

@ -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<memory.size();i++) {
if (i && i % ROW_SZ == 0) {
prints(" ", S ascii);
fmt::print("\n0x{:016x} ", i+offset);
}
hex02(memory[i], hxbuf);
unsigned char idx = memory[i];
hex02(idx, hxbuf);
prints(hxbuf, " ");
ascii[i%ROW_SZ] = ascii_map[memory[i]];
ascii[i%ROW_SZ] = ascii_map[idx];
}
if (memory.size() % ROW_SZ != 0)
{

Loading…
Cancel
Save