[space-map] Add new virtual methods to inc or dec by a specific amount.
Provide default implementation that just loops
This commit is contained in:
parent
5e6eec1bb0
commit
2ed089a83f
@ -48,6 +48,17 @@ namespace persistent_data {
|
||||
virtual void inc(block_address b) = 0;
|
||||
virtual void dec(block_address b) = 0;
|
||||
|
||||
// slow default implementation
|
||||
virtual void inc(block_address b, uint32_t count) {
|
||||
for (uint32_t i = 0; i < count; i++)
|
||||
inc(b);
|
||||
}
|
||||
|
||||
virtual void dec(block_address b, uint32_t count) {
|
||||
for (uint32_t i = 0; i < count; i++)
|
||||
dec(b);
|
||||
}
|
||||
|
||||
// FIXME: change these to return an optional, failure is
|
||||
// not that rare if we're restricting the area that's
|
||||
// searched.
|
||||
|
Loading…
Reference in New Issue
Block a user