summaryrefslogtreecommitdiff
path: root/src/ipa/libipa
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-11-18 20:54:15 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-11-26 19:05:19 +0200
commitb68d898909e346df6bfd02e516f101867ee6ed21 (patch)
tree420c431dc22e886e175ff0edc750ee7f5acc1fe7 /src/ipa/libipa
parentbc10ffca97fffe6d5ee9a7a054fb05bba13607a8 (diff)
ipa: libipa: vector: Add scalar constructor
The default constructor leaves the vector data uninitialized. Add a constructor to fill the vector with copies of a scalar value, and fix the documentation of the default constructor. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Diffstat (limited to 'src/ipa/libipa')
-rw-r--r--src/ipa/libipa/vector.cpp8
-rw-r--r--src/ipa/libipa/vector.h5
2 files changed, 12 insertions, 1 deletions
diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp
index 0f0511da..5851b9ae 100644
--- a/src/ipa/libipa/vector.cpp
+++ b/src/ipa/libipa/vector.cpp
@@ -29,7 +29,13 @@ namespace ipa {
/**
* \fn Vector::Vector()
- * \brief Construct a zero vector
+ * \brief Construct an uninitialized vector
+ */
+
+/**
+ * \fn Vector::Vector(T scalar)
+ * \brief Construct a vector filled with a \a scalar value
+ * \param[in] scalar The scalar value
*/
/**
diff --git a/src/ipa/libipa/vector.h b/src/ipa/libipa/vector.h
index 3168835b..5fb7ad7c 100644
--- a/src/ipa/libipa/vector.h
+++ b/src/ipa/libipa/vector.h
@@ -35,6 +35,11 @@ class Vector
public:
constexpr Vector() = default;
+ constexpr explicit Vector(T scalar)
+ {
+ data_.fill(scalar);
+ }
+
constexpr Vector(const std::array<T, Rows> &data)
{
for (unsigned int i = 0; i < Rows; i++)
href='#n204'>204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2021, Google Inc.
 *
 * fence.cpp - Fence test
 */

#include <iostream>
#include <memory>
#include <sys/eventfd.h>
#include <unistd.h>

#include <libcamera/base/event_dispatcher.h>