MemBuffer.subref(errfmt, skip, take) checks that a subinterval is inside

modified:   mem.cpp
	modified:   mem.h
This commit is contained in:
John Reiser
2017-11-09 21:55:41 -08:00
parent 58771ecca6
commit f014406b65
2 changed files with 17 additions and 0 deletions
+5
View File
@@ -64,6 +64,11 @@ public:
void clear(unsigned off, unsigned len) { fill(off, len, 0); }
void clear() { fill(0, b_size, 0); }
// If the entire range [skip, take+skip) is inside the buffer,
// then return &b[skip]; else throwCantPack(sprintf(errfmt, skip, take)).
// This is similar to BoundedPtr, except only checks once.
unsigned char *subref(char const *errfmt, unsigned skip, unsigned take);
private:
unsigned char *b;
unsigned b_size;