From patchwork Wed Jan 14 17:39:16 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 25812 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 B1E51C3285 for ; Wed, 14 Jan 2026 17:39:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A5F6161FEC; Wed, 14 Jan 2026 18:39:42 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="emw6MT0M"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4AD8B61FDA for ; Wed, 14 Jan 2026 18:39:27 +0100 (CET) Received: from Monstersaurus.infra.iob (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 58D0828F5; Wed, 14 Jan 2026 18:39:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1768412340; bh=xNyBP2yal5rcjb+yjDnH7ikpoplhq9vsZMBSBVS+H5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=emw6MT0MxQ/NZygx2STj3mhWBnQyXJwZtAQ/cFuAqWYS4fPRQcL4O9UUJPmUPa/2y G0pNftmGjHNqYtmL2szhnaiu1a2RPTXdvotAawNbdZSDMPi0Lae7s9cramqCLs7fWa 7eO9fkFU3R+GMJVNHuLIWAjBB6uvh7+LAprdwSVg= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham , =?utf-8?q?Barnab?= =?utf-8?b?w6FzIFDFkWN6ZQ==?= Subject: [PATCH v5 16/16] ipa: libipa: fixedpoint: Remove unsigned workaround Date: Wed, 14 Jan 2026 17:39:16 +0000 Message-ID: <20260114173918.1744023-17-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114173918.1744023-1-kieran.bingham@ideasonboard.com> References: <20260114173918.1744023-1-kieran.bingham@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" Now that we no longer attempt or allow storing signed negative floats as an unsigned integer representation, remove the workaround which required an intermediate cast when converting floats to fixed point values. Reviewed-by: Barnabás Pőcze Signed-off-by: Kieran Bingham --- src/ipa/libipa/fixedpoint.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/ipa/libipa/fixedpoint.h b/src/ipa/libipa/fixedpoint.h index 1d53b0b9fdde..b4190988f1ee 100644 --- a/src/ipa/libipa/fixedpoint.h +++ b/src/ipa/libipa/fixedpoint.h @@ -69,12 +69,7 @@ public: { v = std::clamp(v, min, max); - /* - * The intermediate cast to int is needed on arm platforms to - * 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(std::round(v * (1 << F))) & bitMask; } };