diff --git a/src/kaleidoscope/driver/storage/Base.h b/src/kaleidoscope/driver/storage/Base.h index a2dae8d0..00cc481a 100644 --- a/src/kaleidoscope/driver/storage/Base.h +++ b/src/kaleidoscope/driver/storage/Base.h @@ -25,6 +25,7 @@ namespace storage { struct BaseProps { static constexpr uint16_t length = 0; + static constexpr uint8_t uninitialized_byte = 0xff; }; template @@ -48,6 +49,14 @@ class Base { void update(int idx, uint8_t val) {} + bool isSliceUninitialized(uint16_t offset, uint16_t size) { + for (uint16_t o = offset; o < offset + size; o++) { + if (read(o) != _StorageProps::uninitialized_byte) + return false; + } + return true; + } + const uint16_t length() { return _StorageProps::length; }