From 3bb112fad9e9a526d4c901b4a35db768208e9653 Mon Sep 17 00:00:00 2001 From: Jinwoo Kim Date: Mon, 5 Jan 2026 11:54:43 +0900 Subject: [PATCH] Fix AlignmentKey.bits calculation logic --- Sources/OpenSwiftUICore/Layout/Alignment/AlignmentGuide.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/OpenSwiftUICore/Layout/Alignment/AlignmentGuide.swift b/Sources/OpenSwiftUICore/Layout/Alignment/AlignmentGuide.swift index 0dae8a3c5..4428407be 100644 --- a/Sources/OpenSwiftUICore/Layout/Alignment/AlignmentGuide.swift +++ b/Sources/OpenSwiftUICore/Layout/Alignment/AlignmentGuide.swift @@ -1241,7 +1241,7 @@ public struct AlignmentKey: Hashable, Comparable { package var axis: Axis { bits & 1 == 0 ? .horizontal : .vertical } @inline(__always) - var index: Int { Int(bits / 2 - 1) } + var index: Int { Int((bits - 2) >> 1) } package init(id: any AlignmentID.Type, axis: Axis) { let index = Self.$typeCache.access { cache in @@ -1255,7 +1255,7 @@ public struct AlignmentKey: Hashable, Comparable { return index } } - bits = (axis == .horizontal ? 0 : 1) + (index + 1) * 2 + bits = ((index << 1) | (axis == .horizontal ? 0 : 1)) &+ 2 } package init() { bits = .zero }