From patchwork Mon Nov 16 17:48:57 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: 28914 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 A6800C3304 for ; Mon, 16 Nov 2026 17:49:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 04D8F6A837; Mon, 16 Nov 2026 18:49:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Im+eLfwv"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0726C69089 for ; Mon, 16 Nov 2026 18:49:24 +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 9835263C; Mon, 16 Nov 2026 18:46:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1794851217; bh=XyIloSZtlSTOte0wp6uoYaxkjXVhKclxZ7Qz6f6REXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Im+eLfwvJO51JfrvQHs0qOu1eW2bMJactTOEMM8BzBgE7iJUr5jVZpnUp0/rp3dp+ JFPYrlgABXGiDP47mYmypUqQg/eDwWN5SdduAIJK2kHPd2B1ZyWfVcQ8z8OP2/aIsl J6LVMB36ZDfCxpa6BLGRu7/z4u82vkNI6I/UAwVQ= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Cc: Kieran Bingham , Jacopo Mondi Subject: [PATCH v5 01/22] ipa: libipa: fixedpoint: Shift unsigned type for scaling Date: Mon, 16 Nov 2026 18:48:57 +0100 Message-ID: <20261116174919.1056403-2-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261116174919.1056403-1-barnabas.pocze@ideasonboard.com> References: <20261116174919.1056403-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; } };