File tree Expand file tree Collapse file tree 1 file changed +9
-48
lines changed Expand file tree Collapse file tree 1 file changed +9
-48
lines changed Original file line number Diff line number Diff line change @@ -207,52 +207,13 @@ function UnsafeAtomics.cas!(
207207 success_ordering,
208208 failure_ordering,
209209) where {T}
210- if sizeof (T) == 1
211- (old, success) = UnsafeAtomics. cas! (
212- Ptr {UInt8} (x),
213- bitcast (UInt8, cmp),
214- bitcast (UInt8, new),
215- success_ordering,
216- failure_ordering,
217- )
218- return (old = bitcast (T, old), success = success)
219- elseif sizeof (T) == 2
220- (old, success) = UnsafeAtomics. cas! (
221- Ptr {UInt16} (x),
222- bitcast (UInt16, cmp),
223- bitcast (UInt16, new),
224- success_ordering,
225- failure_ordering,
226- )
227- return (old = bitcast (T, old), success = success)
228- elseif sizeof (T) == 4
229- (old, success) = UnsafeAtomics. cas! (
230- Ptr {UInt32} (x),
231- bitcast (UInt32, cmp),
232- bitcast (UInt32, new),
233- success_ordering,
234- failure_ordering,
235- )
236- return (old = bitcast (T, old), success = success)
237- elseif sizeof (T) == 8
238- (old, success) = UnsafeAtomics. cas! (
239- Ptr {UInt64} (x),
240- bitcast (UInt64, cmp),
241- bitcast (UInt64, new),
242- success_ordering,
243- failure_ordering,
244- )
245- return (old = bitcast (T, old), success = success)
246- elseif sizeof (T) == 16
247- (old, success) = UnsafeAtomics. cas! (
248- Ptr {UInt128} (x),
249- bitcast (UInt128, cmp),
250- bitcast (UInt128, new),
251- success_ordering,
252- failure_ordering,
253- )
254- return (old = bitcast (T, old), success = success)
255- else
256- error (LazyString (" unsupported size: " , sizeof (T)))
257- end
210+ UI = as_native_uint (T)
211+ (old, success) = UnsafeAtomics. cas! (
212+ Ptr {UI} (x),
213+ bitcast (UI, cmp),
214+ bitcast (UI, new),
215+ success_ordering,
216+ failure_ordering,
217+ )
218+ return (old = bitcast (T, old), success = success)
258219end
You can’t perform that action at this time.
0 commit comments