@@ -229,6 +229,116 @@ extension Bool.AtomicRepresentation {
229229 }
230230}
231231
232+ extension Atomic where Value == Bool {
233+ /// Perform an atomic logical AND operation and return the original value, applying
234+ /// the specified memory ordering.
235+ ///
236+ /// - Parameter operand: A boolean value.
237+ /// - Parameter ordering: The memory ordering to apply on this operation.
238+ /// - Returns: The original value before the operation.
239+ @_semantics ( " atomics.requires_constant_orderings " )
240+ @_transparent @_alwaysEmitIntoClient
241+ public func loadThenLogicalAnd(
242+ with operand: Value ,
243+ ordering: AtomicUpdateOrdering
244+ ) -> Value {
245+ Value . AtomicRepresentation. atomicLoadThenLogicalAnd (
246+ with: operand,
247+ at: _ptr,
248+ ordering: ordering)
249+ }
250+ /// Perform an atomic logical OR operation and return the original value, applying
251+ /// the specified memory ordering.
252+ ///
253+ /// - Parameter operand: A boolean value.
254+ /// - Parameter ordering: The memory ordering to apply on this operation.
255+ /// - Returns: The original value before the operation.
256+ @_semantics ( " atomics.requires_constant_orderings " )
257+ @_transparent @_alwaysEmitIntoClient
258+ public func loadThenLogicalOr(
259+ with operand: Value ,
260+ ordering: AtomicUpdateOrdering
261+ ) -> Value {
262+ Value . AtomicRepresentation. atomicLoadThenLogicalOr (
263+ with: operand,
264+ at: _ptr,
265+ ordering: ordering)
266+ }
267+ /// Perform an atomic logical XOR operation and return the original value, applying
268+ /// the specified memory ordering.
269+ ///
270+ /// - Parameter operand: A boolean value.
271+ /// - Parameter ordering: The memory ordering to apply on this operation.
272+ /// - Returns: The original value before the operation.
273+ @_semantics ( " atomics.requires_constant_orderings " )
274+ @_transparent @_alwaysEmitIntoClient
275+ public func loadThenLogicalXor(
276+ with operand: Value ,
277+ ordering: AtomicUpdateOrdering
278+ ) -> Value {
279+ Value . AtomicRepresentation. atomicLoadThenLogicalXor (
280+ with: operand,
281+ at: _ptr,
282+ ordering: ordering)
283+ }
284+ }
285+
286+ extension Atomic where Value == Bool {
287+ /// Perform an atomic logical AND operation and return the original value, applying
288+ /// the specified memory ordering.
289+ ///
290+ /// - Parameter operand: A boolean value.
291+ /// - Parameter ordering: The memory ordering to apply on this operation.
292+ /// - Returns: The original value before the operation.
293+ @_semantics ( " atomics.requires_constant_orderings " )
294+ @_transparent @_alwaysEmitIntoClient
295+ public func logicalAndThenLoad(
296+ with operand: Value ,
297+ ordering: AtomicUpdateOrdering
298+ ) -> Value {
299+ let original = Value . AtomicRepresentation. atomicLoadThenLogicalAnd (
300+ with: operand,
301+ at: _ptr,
302+ ordering: ordering)
303+ return original && operand
304+ }
305+ /// Perform an atomic logical OR operation and return the original value, applying
306+ /// the specified memory ordering.
307+ ///
308+ /// - Parameter operand: A boolean value.
309+ /// - Parameter ordering: The memory ordering to apply on this operation.
310+ /// - Returns: The original value before the operation.
311+ @_semantics ( " atomics.requires_constant_orderings " )
312+ @_transparent @_alwaysEmitIntoClient
313+ public func logicalOrThenLoad(
314+ with operand: Value ,
315+ ordering: AtomicUpdateOrdering
316+ ) -> Value {
317+ let original = Value . AtomicRepresentation. atomicLoadThenLogicalOr (
318+ with: operand,
319+ at: _ptr,
320+ ordering: ordering)
321+ return original || operand
322+ }
323+ /// Perform an atomic logical XOR operation and return the original value, applying
324+ /// the specified memory ordering.
325+ ///
326+ /// - Parameter operand: A boolean value.
327+ /// - Parameter ordering: The memory ordering to apply on this operation.
328+ /// - Returns: The original value before the operation.
329+ @_semantics ( " atomics.requires_constant_orderings " )
330+ @_transparent @_alwaysEmitIntoClient
331+ public func logicalXorThenLoad(
332+ with operand: Value ,
333+ ordering: AtomicUpdateOrdering
334+ ) -> Value {
335+ let original = Value . AtomicRepresentation. atomicLoadThenLogicalXor (
336+ with: operand,
337+ at: _ptr,
338+ ordering: ordering)
339+ return original != operand
340+ }
341+ }
232342extension UnsafeAtomic where Value == Bool {
233343 /// Perform an atomic logical AND operation and return the original value, applying
234344 /// the specified memory ordering.
0 commit comments