@@ -14,37 +14,32 @@ import Builtin
14
14
15
15
% from SwiftAtomics import *
16
16
17
- % for (type, size, alignment, builtin) in atomicTypes:
17
+ % for (type, size, alignment, builtin, swift ) in atomicTypes:
18
18
19
19
//===----------------------------------------------------------------------===//
20
20
// ${size} bit Atomic Storage
21
21
//===----------------------------------------------------------------------===//
22
22
23
- % if type == "WordPair":
24
23
@available(SwiftStdlib 5.11, *)
25
- % end
26
- extension ${type} {
27
- /// The storage representation type that `Self` encodes to and decodes from
28
- /// which is a suitable type when used in atomic operations.
24
+ @frozen
25
+ @_alignment(${alignment})
26
+ public struct ${type} {
27
+ public var _storage: ${builtin}
28
+
29
29
@available(SwiftStdlib 5.11, *)
30
- @_alignment(${alignment})
31
- @frozen
32
- public struct AtomicRepresentation {
33
- public var _storage: ${builtin}
34
-
35
- @available(SwiftStdlib 5.11, *)
36
- @_alwaysEmitIntoClient
37
- @_transparent
38
- public init(_ _builtin: ${builtin}) {
39
- self._storage = _builtin
40
- }
30
+ @_alwaysEmitIntoClient
31
+ @_transparent
32
+ public init(_ _builtin: ${builtin}) {
33
+ self._storage = _builtin
41
34
}
42
35
}
43
36
44
- // ${size} bit atomic loads
37
+ //===----------------------------------------------------------------------===//
38
+ // ${size} bit atomic load
39
+ //===----------------------------------------------------------------------===//
45
40
46
41
@available(SwiftStdlib 5.11, *)
47
- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
42
+ extension Atomic where Value.AtomicRepresentation == ${type} {
48
43
/// Atomically loads and returns the current value, applying the specified
49
44
/// memory ordering.
50
45
///
@@ -69,10 +64,12 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
69
64
}
70
65
}
71
66
72
- // ${size} bit atomic stores
67
+ //===----------------------------------------------------------------------===//
68
+ // ${size} bit atomic store
69
+ //===----------------------------------------------------------------------===//
73
70
74
71
@available(SwiftStdlib 5.11, *)
75
- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
72
+ extension Atomic where Value.AtomicRepresentation == ${type} {
76
73
/// Atomically sets the current value to `desired`, applying the specified
77
74
/// memory ordering.
78
75
///
@@ -101,10 +98,12 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
101
98
}
102
99
}
103
100
101
+ //===----------------------------------------------------------------------===//
104
102
// ${size} bit atomic exchanges
103
+ //===----------------------------------------------------------------------===//
105
104
106
105
@available(SwiftStdlib 5.11, *)
107
- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
106
+ extension Atomic where Value.AtomicRepresentation == ${type} {
108
107
/// Atomically sets the current value to `desired` and returns the original
109
108
/// value, applying the specified memory ordering.
110
109
///
@@ -137,10 +136,12 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
137
136
}
138
137
}
139
138
140
- // ${size} bit atomic compare and exchanges
139
+ //===----------------------------------------------------------------------===//
140
+ // ${size} bit atomic compare exchanges
141
+ //===----------------------------------------------------------------------===//
141
142
142
143
@available(SwiftStdlib 5.11, *)
143
- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
144
+ extension Atomic where Value.AtomicRepresentation == ${type} {
144
145
/// Perform an atomic compare and exchange operation on the current value,
145
146
/// applying the specified memory ordering.
146
147
///
@@ -181,7 +182,7 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
181
182
}
182
183
183
184
@available(SwiftStdlib 5.11, *)
184
- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
185
+ extension Atomic where Value.AtomicRepresentation == ${type} {
185
186
/// Perform an atomic compare and exchange operation on the current value,
186
187
/// applying the specified success/failure memory orderings.
187
188
///
@@ -246,10 +247,12 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
246
247
}
247
248
}
248
249
249
- // ${size} bit atomic weak compare and exchanges
250
+ //===----------------------------------------------------------------------===//
251
+ // ${size} bit weak compare exchanges
252
+ //===----------------------------------------------------------------------===//
250
253
251
254
@available(SwiftStdlib 5.11, *)
252
- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
255
+ extension Atomic where Value.AtomicRepresentation == ${type} {
253
256
/// Perform an atomic weak compare and exchange operation on the current
254
257
/// value, applying the memory ordering. This compare-exchange variant is
255
258
/// allowed to spuriously fail; it is designed to be called in a loop until
@@ -299,7 +302,7 @@ extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentatio
299
302
}
300
303
301
304
@available(SwiftStdlib 5.11, *)
302
- extension Atomic where Value.AtomicRepresentation == ${type}.AtomicRepresentation {
305
+ extension Atomic where Value.AtomicRepresentation == ${type} {
303
306
/// Perform an atomic weak compare and exchange operation on the current
304
307
/// value, applying the specified success/failure memory orderings. This
305
308
/// compare-exchange variant is allowed to spuriously fail; it is designed to
0 commit comments