From patchwork Mon Jun 22 10:15:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 27010 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 6F0C3C3303 for ; Mon, 22 Jun 2026 10:15:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9E9306570F; Mon, 22 Jun 2026 12:15:39 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mmMFs9q9"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CD9846570F for ; Mon, 22 Jun 2026 12:15:37 +0200 (CEST) Received: from killaraus.ideasonboard.com (2001-14ba-70f3-e800--a06.rev.dnainternet.fi [IPv6:2001:14ba:70f3:e800::a06]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id CC71E874 for ; Mon, 22 Jun 2026 12:14:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1782123300; bh=OCPfBR/vJ+0rzuXie2uWbxDogmroHiAPw0GCLDHZqNA=; h=From:To:Subject:Date:From; b=mmMFs9q9d9rQpXZOhd/6Eax4Rwskm5B0wIZxSbSNQQh8JTz/n4a3qJjFOeVSz/zMO LeHYwblQBHYT3KivXn4Od4nLpnemW7WSifP1dgYiOfFZsXyQIC8RztwYSksw0/ZaLI yitwmfSTBfYyzenssETLAGGYohimgJGjHNe2Pb2w= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH] libcamera: vector: Replace custom lambdas with standard functions Date: Mon, 22 Jun 2026 13:15:36 +0300 Message-ID: <20260622101536.3886913-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The implementation of operator{+,-,/,*}= uses custom lambdas the std::plus, std::minus, std::multiplies and std::divides standard objects. Replace the manual implementation to simplify the code. Signed-off-by: Laurent Pinchart Reviewed-by: Barnabás Pőcze Reviewed-by: Kieran Bingham --- This patch applies on top of "[PATCH 0/4] libcamera: vector: Add clamp() function". --- include/libcamera/internal/vector.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) base-commit: bd266aa3405d3aea20b407b27e52482b02146030 prerequisite-patch-id: cd23c4b11eb03f4ed3a6ce924dc40b2122c3d996 prerequisite-patch-id: 9134d77756d5822a87717f016e7f0b0f0b11caf2 prerequisite-patch-id: 76085046643e01f0e288e8d1eab0eae4c3cd653e prerequisite-patch-id: f2029084f2d806ad9587d3a274beb6e42b63fb23 diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h index 0270651a0ef7..0af629e69d56 100644 --- a/include/libcamera/internal/vector.h +++ b/include/libcamera/internal/vector.h @@ -120,42 +120,42 @@ public: Vector &operator+=(const Vector &other) { - return apply([](T a, T b) { return a + b; }, other); + return apply(std::plus<>{}, other); } Vector &operator+=(T scalar) { - return apply([](T a, T b) { return a + b; }, scalar); + return apply(std::plus<>{}, scalar); } Vector &operator-=(const Vector &other) { - return apply([](T a, T b) { return a - b; }, other); + return apply(std::minus<>{}, other); } Vector &operator-=(T scalar) { - return apply([](T a, T b) { return a - b; }, scalar); + return apply(std::minus<>{}, scalar); } Vector &operator*=(const Vector &other) { - return apply([](T a, T b) { return a * b; }, other); + return apply(std::multiplies<>{}, other); } Vector &operator*=(T scalar) { - return apply([](T a, T b) { return a * b; }, scalar); + return apply(std::multiplies<>{}, scalar); } Vector &operator/=(const Vector &other) { - return apply([](T a, T b) { return a / b; }, other); + return apply(std::divides<>{}, other); } Vector &operator/=(T scalar) { - return apply([](T a, T b) { return a / b; }, scalar); + return apply(std::divides<>{}, scalar); } Vector &operator>>=(unsigned int shift)