base: Added helper function for iterating over an affinity location.

This commit is contained in:
Michael Mueller
2025-02-27 16:25:11 +01:00
parent afbe7e1c3e
commit 3441df3578

View File

@@ -166,6 +166,15 @@ class Genode::Affinity
node.attribute_value("height", default_height));
}
template<typename FUNC>
void for_each(const FUNC &fn) {
for (unsigned y = _ypos; y < _ypos + height(); y++) {
for (unsigned x = _xpos; x < _xpos+_width; x++) {
fn(Genode::Affinity::Location(x, y, _width, _height));
}
}
}
};
private: