From 3441df3578a46c7518ac025797513ade7755f807 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Thu, 27 Feb 2025 16:25:11 +0100 Subject: [PATCH] base: Added helper function for iterating over an affinity location. --- repos/base/include/base/affinity.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/repos/base/include/base/affinity.h b/repos/base/include/base/affinity.h index 6025ba8181..821e72349e 100644 --- a/repos/base/include/base/affinity.h +++ b/repos/base/include/base/affinity.h @@ -166,6 +166,15 @@ class Genode::Affinity node.attribute_value("height", default_height)); } + template + 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: