Message ID | 20250421153556.171192-3-barnabas.pocze@ideasonboard.com |
---|---|
State | New |
Headers | show |
Series |
|
Related | show |
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@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@ideasonboard.com> > union { > uint64_t internal; > void *external; > -- > 2.49.0 >
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_; union { uint64_t internal; void *external;
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@ideasonboard.com> --- include/libcamera/controls.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)