summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/base/utils.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h
index 3a803176..9ab18101 100644
--- a/include/libcamera/base/utils.h
+++ b/include/libcamera/base/utils.h
@@ -346,6 +346,15 @@ public:
}
};
+template<typename T>
+decltype(auto) abs_diff(const T &a, const T &b)
+{
+ if (a < b)
+ return b - a;
+ else
+ return a - b;
+}
+
} /* namespace utils */
#ifndef __DOXYGEN__