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

#if !WASM
namespace CommonHelpers {
#else
namespace CommonHelpers.WASM {
#endif

//**************************************************************************************************
/// <summary>
/// </summary>
partial class HFlags {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/// <exception cref="ArgumentOutOfRangeException" />
public static int ClearBit(ref int location,int bitNo)
{
   return location &= ~HInt32.Flag( bitNo );
}

/// <exception cref="ArgumentOutOfRangeException" />
public static long ClearBit(ref long location,int bitNo)
{
   return location &= ~HInt64.Flag( bitNo );
}

/// <exception cref="ArgumentOutOfRangeException" />
public static short ClearBit(ref short location,int bitNo)
{
   return location &= unchecked( (short)~HInt16.Flag( bitNo ) );
}

/// <exception cref="ArgumentOutOfRangeException" />
public static byte ClearBit(ref byte location,int bitNo)
{
   return location &= unchecked( (byte)~HByte.Flag( bitNo ) );
}

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

/// <exception cref="ArgumentOutOfRangeException" />
[CLSCompliant(false)]
public static uint ClearBit(ref uint location,int bitNo)
{
   return location &= ~HUInt32.Flag( bitNo );
}

/// <exception cref="ArgumentOutOfRangeException" />
[CLSCompliant(false)]
public static ulong ClearBit(ref ulong location,int bitNo)
{
   return location &= ~HUInt64.Flag( bitNo );
}

/// <exception cref="ArgumentOutOfRangeException" />
[CLSCompliant(false)]
public static ushort ClearBit(ref ushort location,int bitNo)
{
   return location &= unchecked( (ushort)~HUInt16.Flag( bitNo ) );
}

/// <exception cref="ArgumentOutOfRangeException" />
[CLSCompliant(false)]
public static sbyte ClearBit(ref sbyte location,int bitNo)
{
   return location &= unchecked( (sbyte)~HSByte.Flag( bitNo ) );
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HFlags
//**************************************************************************************************

} // CommonHelpers (.WASM)
