//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// CommonHelpers satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;

namespace CommonHelpers {

//**************************************************************************************************
/// <summary>
/// </summary>
public static partial class HUPointer {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public static readonly UIntPtr
   NullValue = UIntPtr.Zero,
   AllBitsValue = (UIntPtr)(-1);

//==================================================================================================

public static bool IsNull(UIntPtr value)
{
   return value == NullValue;
}

public static bool IsAllBitsValue(UIntPtr value)
{
   return value == AllBitsValue;
}

//==================================================================================================

public static UIntPtr Exchange([HVolatileAccess] ref UIntPtr operand,UIntPtr value)
{
   return HUIntPtr.Exchange(ref operand,value);
}

public static UIntPtr NullValueExchange([HVolatileAccess] ref UIntPtr operand)
{
   return Exchange(ref operand,NullValue);
}

public static UIntPtr AllBitsValueExchange([HVolatileAccess] ref UIntPtr operand)
{
   return Exchange(ref operand,AllBitsValue);
}

//--------------------------------------------------------------------------------------------------

public static void Swap( [HVolatileAccess] ref UIntPtr operand_1,
                         [HVolatileAccess] ref UIntPtr operand_2 )
{
   HUIntPtr.Swap(ref operand_1,ref operand_2);
}

//==================================================================================================

public static UIntPtr IsNullSubstitution(UIntPtr value,UIntPtr subst)
{
   return XValueSubstitution(value,NullValue,subst);
}

public static UIntPtr SubstiteNullValue([HVolatileAccess] ref UIntPtr operand,UIntPtr subst)
{
   return SubstituteXValue(ref operand,NullValue,subst);
} 

//--------------------------------------------------------------------------------------------------

public static UIntPtr AllBitsValueSubstitution(UIntPtr value,UIntPtr subst)
{
   return XValueSubstitution(value,AllBitsValue,subst);
}

public static UIntPtr SubstiteAllBitsValue([HVolatileAccess] ref UIntPtr operand,UIntPtr subst)
{
   return SubstituteXValue(ref operand,AllBitsValue,subst);
} 

//--------------------------------------------------------------------------------------------------

public static UIntPtr XValueSubstitution(UIntPtr value,UIntPtr xValue,UIntPtr subst)
{
   return HUIntPtr.XValueSubstitution(value,xValue,subst);
}

public static UIntPtr SubstituteXValue( [HVolatileAccess] ref UIntPtr operand,
                                        UIntPtr xValue, UIntPtr subst )
{
   return HUIntPtr.SubstituteXValue(ref operand,xValue,subst);
}

//==================================================================================================

static HUPointer()
{
   CommonHelpers_PAccess.Access();
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HUPointer
//**************************************************************************************************

} // CommonHelpers
