[v3,01/21] ipa: libipa: fixedpoint: Shift unsigned type for scaling
diff mbox series

Message ID 20260918120949.191668-2-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • libcamera: rcar-gen4 + rpp-x1
Related show

Commit Message

Barnabás Pőcze Sept. 18, 2026, 12:09 p.m. UTC
Avoid shifting into the potential sign bit of `T`. The same is already
done in `toFloat()`.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 src/ipa/libipa/fixedpoint.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch
diff mbox series

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<UT>(static_cast<T>(std::round(v * (1 << F)))) & bitMask;
+		return static_cast<UT>(static_cast<T>(std::round(v * (UT{ 1 } << F)))) & bitMask;
 	}
 };