Beispiel #1
0
 /// <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));
 }
Beispiel #2
0
 /// <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));
 }
Beispiel #3
0
        /// <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);
        }
Beispiel #4
0
        /// <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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
 /// <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));
 }