From patchwork Wed Nov 18 13:31:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 28990 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 34275BDE17 for ; Wed, 18 Nov 2026 13:31:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7C9756A8DC; Wed, 18 Nov 2026 14:31:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="B+9B69cE"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2CC956A8C4 for ; Wed, 18 Nov 2026 14:31:28 +0100 (CET) Received: from pb-laptop.local (185.221.140.49.nat.pool.zt.hu [185.221.140.49]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AC53C1D18; Wed, 18 Nov 2026 14:28:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1795008539; bh=XyIloSZtlSTOte0wp6uoYaxkjXVhKclxZ7Qz6f6REXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B+9B69cEX2h980HR/sdkoPyjtepDEsys+U/0cJj99sJ2v+VaTfy45/cD6ELdpwxnY TDPVb62n8At8JAL2SysqaWsrpDyHX2luTVI8IOm/9ZXHCoEBA0TiarjH4Pq20SH4jQ pAtPzuDuwkDhNAl0/G/dnOMghkbXWJIK0eRMs3eo= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Kieran Bingham , Jacopo Mondi Subject: [PATCH v6 01/23] ipa: libipa: fixedpoint: Shift unsigned type for scaling Date: Wed, 18 Nov 2026 14:31:01 +0100 Message-ID: <20261118133123.1710288-2-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261118133123.1710288-1-barnabas.pocze@ideasonboard.com> References: <20261118133123.1710288-1-barnabas.pocze@ideasonboard.com> 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" Avoid shifting into the potential sign bit of `T`. The same is already done in `toFloat()`. Signed-off-by: Barnabás Pőcze Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/ipa/libipa/fixedpoint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipa/libipa/fixedpoint.h b/src/ipa/libipa/fixedpoint.h index ed8aca9f15..537bc774a4 100644 --- a/src/ipa/libipa/fixedpoint.h +++ b/src/ipa/libipa/fixedpoint.h @@ -78,7 +78,7 @@ public: * properly cast negative values. See * https://embeddeduse.com/2013/08/25/casting-a-negative-float-to-an-unsigned-int/ */ - return static_cast(static_cast(std::round(v * (1 << F)))) & bitMask; + return static_cast(static_cast(std::round(v * (UT{ 1 } << F)))) & bitMask; } };