[PATCH v2 2/5] libcamera: controls: Replace `numElements_` bit field

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Apr 28 09:20:05 CEST 2025


Quoting Barnabás Pőcze (2025-04-21 16:35:53)
> Instead of using a 32-bit wide bit field of `std::size_t`, simply
> use a `uint32_t` to store the number of elements. This makes it
> possible to construct references, and use e.g. `std::swap()`.
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze at ideasonboard.com>
> ---
>  include/libcamera/controls.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h
> index 1dc6ccffa..3f3580036 100644
> --- a/include/libcamera/controls.h
> +++ b/include/libcamera/controls.h
> @@ -236,7 +236,7 @@ public:
>  private:
>         ControlType type_ : 8;
>         bool isArray_;
> -       std::size_t numElements_ : 32;
> +       uint32_t numElements_;

It even looks ABI compatible.

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

>         union {
>                 uint64_t internal;
>                 void *external;
> -- 
> 2.49.0
>


More information about the libcamera-devel mailing list