Skip to content

Commit 216a4b5

Browse files
committed
[struct Atomic] Use dependent layout
1 parent 8727339 commit 216a4b5

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Sources/Atomics/Atomic.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
#if compiler(>=5.9) && $RawLayout
1414
import Builtin
1515

16-
// FIXME: What we actually want to say is @_rawLayout(like: Value.AtomicRepresentation)
17-
@_rawLayout(like: DoubleWord.AtomicRepresentation)
16+
@_rawLayout(like: Value.AtomicRepresentation)
1817
@frozen
1918
public struct Atomic<Value: AtomicValue>: ~Copyable
2019
where Value.AtomicRepresentation.Value == Value

Sources/Atomics/AtomicBool.swift.gyb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ extension Bool.AtomicRepresentation {
190190
}
191191

192192
% for construct in ["Atomic", "UnsafeAtomic", "ManagedAtomic"]:
193+
% if construct == "Atomic":
194+
#if compiler(>=5.9) && $RawLayout
195+
% end
193196
extension ${construct} where Value == Bool {
194197
% for (name, iname, op, label, doc) in boolOperations:
195198
/// Perform an atomic ${doc} operation and return the original value, applying
@@ -234,4 +237,7 @@ extension ${construct} where Value == Bool {
234237
}
235238
% end
236239
}
240+
% if construct == "Atomic":
241+
#endif
242+
% end
237243
% end

Sources/Atomics/autogenerated/AtomicBool.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ extension Bool.AtomicRepresentation {
229229
}
230230
}
231231

232+
#if compiler(>=5.9) && $RawLayout
232233
extension Atomic where Value == Bool {
233234
/// Perform an atomic logical AND operation and return the original value, applying
234235
/// the specified memory ordering.
@@ -339,6 +340,7 @@ extension Atomic where Value == Bool {
339340
return original != operand
340341
}
341342
}
343+
#endif
342344
extension UnsafeAtomic where Value == Bool {
343345
/// Perform an atomic logical AND operation and return the original value, applying
344346
/// the specified memory ordering.

0 commit comments

Comments
 (0)