From dae4a4406779ba1bc1687446d20c82a1f96b5258 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 25 Feb 2024 18:36:15 +0200 Subject: libcamera: Use utils::to_underlying() Replace manual implementations of the utils::to_underlying() helper with calls to the function. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Naushir Patuck --- src/libcamera/pipeline/rpi/common/rpi_stream.h | 10 +++------- src/libcamera/stream.cpp | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'src/libcamera') diff --git a/src/libcamera/pipeline/rpi/common/rpi_stream.h b/src/libcamera/pipeline/rpi/common/rpi_stream.h index fc2bdfe2..48ed41ab 100644 --- a/src/libcamera/pipeline/rpi/common/rpi_stream.h +++ b/src/libcamera/pipeline/rpi/common/rpi_stream.h @@ -14,6 +14,7 @@ #include #include +#include #include @@ -180,19 +181,14 @@ private: template class Device : public std::array { -private: - constexpr auto index(E e) const noexcept - { - return static_cast>(e); - } public: Stream &operator[](E e) { - return std::array::operator[](index(e)); + return std::array::operator[](utils::to_underlying(e)); } const Stream &operator[](E e) const { - return std::array::operator[](index(e)); + return std::array::operator[](utils::to_underlying(e)); } }; diff --git a/src/libcamera/stream.cpp b/src/libcamera/stream.cpp index f3e00ead..540a428e 100644 --- a/src/libcamera/stream.cpp +++ b/src/libcamera/stream.cpp @@ -433,7 +433,7 @@ std::ostream &operator<<(std::ostream &out, StreamRole role) "Viewfinder", }; - out << names[static_cast>(role)]; + out << names[utils::to_underlying(role)]; return out; } -- cgit v1.2.1