diff --git a/repos/base/include/util/misc_math.h b/repos/base/include/util/misc_math.h index 3f9162b778..31d079d7f2 100644 --- a/repos/base/include/util/misc_math.h +++ b/repos/base/include/util/misc_math.h @@ -22,9 +22,6 @@ namespace Genode { template static constexpr T1 min(T1 v1, T2 v2) { return v1 < v2 ? v1 : v2; } - template - static constexpr T abs(T value) { return value >= 0 ? value : -value; } - /* * Alignment to the power of two diff --git a/repos/base/src/lib/base/avl_tree.cc b/repos/base/src/lib/base/avl_tree.cc index 42d4b35c65..d890ecb763 100644 --- a/repos/base/src/lib/base/avl_tree.cc +++ b/repos/base/src/lib/base/avl_tree.cc @@ -84,6 +84,8 @@ void Avl_node_base::_rebalance_subtree(Avl_node_base *node, Policy &policy) { int v = node->_child_depth(RIGHT) - node->_child_depth(LEFT); + auto abs = [] (auto v) { return v >= 0 ? v : -v; }; + /* return if subtree is in balance */ if (abs(v) < 2) return; diff --git a/repos/gems/include/polygon_gfx/line_painter.h b/repos/gems/include/polygon_gfx/line_painter.h index fed44197a3..9f2e9f1982 100644 --- a/repos/gems/include/polygon_gfx/line_painter.h +++ b/repos/gems/include/polygon_gfx/line_painter.h @@ -139,6 +139,8 @@ struct Line_painter long const dx_f = x2.value - x1.value, dy_f = y2.value - y1.value; + auto abs = [] (auto v) { return v >= 0 ? v : -v; }; + long const num_steps = max(abs(dx_f) + 127, abs(dy_f) + 127) >> 8; if (num_steps == 0) diff --git a/repos/gems/src/app/menu_view/depgraph_widget.h b/repos/gems/src/app/menu_view/depgraph_widget.h index dfdd0bb801..41013b097c 100644 --- a/repos/gems/src/app/menu_view/depgraph_widget.h +++ b/repos/gems/src/app/menu_view/depgraph_widget.h @@ -672,6 +672,8 @@ struct Menu_view::Depgraph_widget : Widget x4 = p2.x(), y4 = p2.y(); + auto abs = [] (auto v) { return v >= 0 ? v : -v; }; + /* subdivide the curve depending on the size of its bounding box */ unsigned const levels = (unsigned)max(log2(max(abs(x4 - x1), abs(y4 - y1)) >> 2), 3); diff --git a/repos/os/include/util/geometry.h b/repos/os/include/util/geometry.h index a4080cc936..4e23bea507 100644 --- a/repos/os/include/util/geometry.h +++ b/repos/os/include/util/geometry.h @@ -66,6 +66,8 @@ class Genode::Point void print(Output &out) const { + auto abs = [] (auto v) { return v >= 0 ? v : -v; }; + Genode::print(out, _x >= 0 ? "+" : "-", abs(_x), _y >= 0 ? "+" : "-", abs(_y)); }