[0/2] libcamera: Add utils::to_underlying() helper
mbox series

Message ID 20240225164348.10073-1-laurent.pinchart@ideasonboard.com
Headers show
Series
  • libcamera: Add utils::to_underlying() helper
Related show

Message

Laurent Pinchart Feb. 25, 2024, 4:43 p.m. UTC
Hello,

C++23 has a std::to_underlying() helper that casts an enumeration to its
underlying type. libcamera open-codes this in multiple places. This
series adds an identical helper to the utils:: namespace, and uses it to
replace the open-coded implementations.

Laurent Pinchart (2):
  libcamera: utils: Add to_underlying() helper function
  libcamera: Use utils::to_underlying()

 include/libcamera/base/utils.h                 |  6 ++++++
 src/ipa/rpi/controller/rpi/sdn.cpp             |  3 ++-
 src/libcamera/base/utils.cpp                   | 10 ++++++++++
 src/libcamera/pipeline/rpi/common/rpi_stream.h | 10 +++-------
 src/libcamera/stream.cpp                       |  2 +-
 5 files changed, 22 insertions(+), 9 deletions(-)


base-commit: 059bbcdc34e7d887ee02fdd47613bd6e0eb70d16

Comments

Jacopo Mondi Feb. 26, 2024, 2:25 p.m. UTC | #1
Hi Laurent

 for the series

 Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

On Sun, Feb 25, 2024 at 06:43:45PM +0200, Laurent Pinchart wrote:
> Hello,
>
> C++23 has a std::to_underlying() helper that casts an enumeration to its
> underlying type. libcamera open-codes this in multiple places. This
> series adds an identical helper to the utils:: namespace, and uses it to
> replace the open-coded implementations.
>
> Laurent Pinchart (2):
>   libcamera: utils: Add to_underlying() helper function
>   libcamera: Use utils::to_underlying()
>
>  include/libcamera/base/utils.h                 |  6 ++++++
>  src/ipa/rpi/controller/rpi/sdn.cpp             |  3 ++-
>  src/libcamera/base/utils.cpp                   | 10 ++++++++++
>  src/libcamera/pipeline/rpi/common/rpi_stream.h | 10 +++-------
>  src/libcamera/stream.cpp                       |  2 +-
>  5 files changed, 22 insertions(+), 9 deletions(-)
>
>
> base-commit: 059bbcdc34e7d887ee02fdd47613bd6e0eb70d16
> --
> Regards,
>
> Laurent Pinchart
>
Naushir Patuck Feb. 27, 2024, 9:38 a.m. UTC | #2
Hi Laurent,

Thanks for the fix.  For both patches:

Reviewed-by: Naushir Patuck <naush@raspberrypi.com>


On Sun, 25 Feb 2024 at 16:43, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
>
> Hello,
>
> C++23 has a std::to_underlying() helper that casts an enumeration to its
> underlying type. libcamera open-codes this in multiple places. This
> series adds an identical helper to the utils:: namespace, and uses it to
> replace the open-coded implementations.
>
> Laurent Pinchart (2):
>   libcamera: utils: Add to_underlying() helper function
>   libcamera: Use utils::to_underlying()
>
>  include/libcamera/base/utils.h                 |  6 ++++++
>  src/ipa/rpi/controller/rpi/sdn.cpp             |  3 ++-
>  src/libcamera/base/utils.cpp                   | 10 ++++++++++
>  src/libcamera/pipeline/rpi/common/rpi_stream.h | 10 +++-------
>  src/libcamera/stream.cpp                       |  2 +-
>  5 files changed, 22 insertions(+), 9 deletions(-)
>
>
> base-commit: 059bbcdc34e7d887ee02fdd47613bd6e0eb70d16
> --
> Regards,
>
> Laurent Pinchart
>