コード例 #1
0
ファイル: Atomic.cs プロジェクト: awesomedotnetcore/ILGPU
 /// <summary>
 /// Represents an atomic compare-exchange operation.
 /// </summary>
 /// <param name="target">the target location.</param>
 /// <param name="compare">The expected comparison value.</param>
 /// <param name="value">The value to add.</param>
 /// <returns>The old value.</returns>
 public static Index CompareExchange(VariableView <Index> target, Index compare, Index value)
 {
     return(CompareExchange(target.Cast <int>(), compare, value));
 }
コード例 #2
0
ファイル: Atomic.cs プロジェクト: awesomedotnetcore/ILGPU
 /// <summary>
 /// Atommically adds the given value and the value at the target location
 /// and returns the old value.
 /// </summary>
 /// <param name="target">the target location.</param>
 /// <param name="value">The value to add.</param>
 /// <returns>The old value that was stored at the target location.</returns>
 public static Index Add(VariableView <Index> target, Index value)
 {
     return(Add(target.Cast <int>(), value));
 }
コード例 #3
0
ファイル: Atomic.cs プロジェクト: awesomedotnetcore/ILGPU
        /// <summary>
        /// Represents an atomic compare-exchange operation.
        /// </summary>
        /// <param name="target">The target location.</param>
        /// <param name="compare">The expected comparison value.</param>
        /// <param name="value">The target value.</param>
        /// <returns>The old value.</returns>
        public static unsafe double CompareExchange(VariableView <double> target, double compare, double value)
        {
            var result = CompareExchange(target.Cast <long>(), *(long *)&compare, *(long *)&value);

            return(*(double *)&result);
        }
コード例 #4
0
ファイル: Atomic.cs プロジェクト: awesomedotnetcore/ILGPU
        /// <summary>
        /// Represents an atomic compare-exchange operation.
        /// </summary>
        /// <param name="target">The target location.</param>
        /// <param name="compare">The expected comparison value.</param>
        /// <param name="value">The target value.</param>
        /// <returns>The old value.</returns>
        public static unsafe float CompareExchange(VariableView <float> target, float compare, float value)
        {
            var result = CompareExchange(target.Cast <int>(), *(int *)&compare, *(int *)&value);

            return(*(float *)&result);
        }
コード例 #5
0
ファイル: Atomic.cs プロジェクト: awesomedotnetcore/ILGPU
        public static unsafe ulong CompareExchange(VariableView <ulong> target, ulong compare, ulong value)
        {
            var result = CompareExchange(target.Cast <long>(), *(long *)&compare, *(long *)&value);

            return(*(ulong *)&result);
        }
コード例 #6
0
ファイル: Atomic.cs プロジェクト: awesomedotnetcore/ILGPU
        public static unsafe uint CompareExchange(VariableView <uint> target, uint compare, uint value)
        {
            var result = CompareExchange(target.Cast <int>(), *(int *)&compare, *(int *)&value);

            return(*(uint *)&result);
        }
コード例 #7
0
ファイル: Atomic.cs プロジェクト: awesomedotnetcore/ILGPU
 /// <summary>
 /// Represents an atomic exchange operation.
 /// </summary>
 /// <param name="target">the target location.</param>
 /// <param name="value">The value to add.</param>
 /// <returns>The old value.</returns>
 public static Index Exchange(VariableView <Index> target, Index value)
 {
     return(Exchange(target.Cast <int>(), value));
 }