/// Compute the bitwise NOT of 32-bit integer a and then AND with b, and store the results in dst.
/// </summary>
/// <remarks>
/// **** andn r32, r32, r32
/// </remarks>
/// <param name="a">32-bit integer</param>
/// <param name="b">32-bit integer</param>
/// <returns>32-bit integer</returns>
[DebuggerStepThrough]
publicstaticuintandn_u32(uinta,uintb)
{
return~a&b;
}
/// <summary>
/// Compute the bitwise NOT of 64-bit integer a and then AND with b, and store the results in dst.
/// </summary>
/// <remarks>
/// **** andn r64, r64, r64
/// </remarks>
/// <param name="a">64-bit integer</param>
/// <param name="b">64-bit integer</param>
/// <returns>64-bit integer</returns>
[DebuggerStepThrough]
publicstaticulongandn_u64(ulonga,ulongb)
{
return~a&b;
}
/// <summary>
/// Extract contiguous bits from unsigned 32-bit integer a, and store the result in dst. Extract the number of bits specified by len, starting at the bit specified by start.
/// Extract contiguous bits from unsigned 64-bit integer a, and store the result in dst. Extract the number of bits specified by len, starting at the bit specified by start.
/// Extract contiguous bits from unsigned 32-bit integer a, and store the result in dst. Extract the number of bits specified by bits 15:8 of control, starting at the bit specified by bits 0:7 of control..
/// </summary>
/// <remarks>
/// **** bextr r32, r32, r32
/// </remarks>
/// <param name="a">32-bit integer</param>
/// <param name="control">Control</param>
/// <returns>32-bit integer</returns>
[DebuggerStepThrough]
publicstaticuintbextr2_u32(uinta,uintcontrol)
{
uintstart=control&byte.MaxValue;
uintlen=(control>>8)&byte.MaxValue;
returnbextr_u32(a,start,len);
}
/// <summary>
/// Extract contiguous bits from unsigned 64-bit integer a, and store the result in dst. Extract the number of bits specified by bits 15:8 of control, starting at the bit specified by bits 0:7 of control..
/// </summary>
/// <remarks>
/// **** bextr r64, r64, r64
/// </remarks>
/// <param name="a">32-bit integer</param>
/// <param name="control">Control</param>
/// <returns>64-bit integer</returns>
[DebuggerStepThrough]
publicstaticulongbextr2_u64(ulonga,ulongcontrol)
{
uintstart=(uint)(control&byte.MaxValue);
uintlen=(uint)((control>>8)&byte.MaxValue);
returnbextr_u64(a,start,len);
}
/// <summary>
/// Extract the lowest set bit from unsigned 32-bit integer a and set the corresponding bit in dst. All other bits in dst are zeroed, and all bits are zeroed if no bits are set in a.
/// </summary>
/// <remarks>
/// **** blsi r32, r32
/// </remarks>
/// <param name="a">32-bit integer</param>
/// <returns>32-bit integer</returns>
[DebuggerStepThrough]
publicstaticuintblsi_u32(uinta)
{
return(uint)(-(int)a)&a;
}
/// <summary>
/// Extract the lowest set bit from unsigned 64-bit integer a and set the corresponding bit in dst. All other bits in dst are zeroed, and all bits are zeroed if no bits are set in a.
/// </summary>
/// <remarks>
/// **** blsi r64, r64
/// </remarks>
/// <param name="a">64-bit integer</param>
/// <returns>64-bit integer</returns>
[DebuggerStepThrough]
publicstaticulongblsi_u64(ulonga)
{
return(ulong)(-(long)a)&a;
}
/// <summary>
/// Set all the lower bits of dst up to and including the lowest set bit in unsigned 32-bit integer a.
/// </summary>
/// <remarks>
/// **** blsmsk r32, r32
/// </remarks>
/// <param name="a">32-bit integer</param>
/// <returns>32-bit integer</returns>
[DebuggerStepThrough]
publicstaticuintblsmsk_u32(uinta)
{
return(a-1)^a;
}
/// <summary>
/// Set all the lower bits of dst up to and including the lowest set bit in unsigned 64-bit integer a.
/// </summary>
/// <remarks>
/// **** blsmsk r64, r64
/// </remarks>
/// <param name="a">64-bit integer</param>
/// <returns>64-bit integer</returns>
[DebuggerStepThrough]
publicstaticulongblsmsk_u64(ulonga)
{
return(a-1)^a;
}
/// <summary>
/// Copy all bits from unsigned 32-bit integer a to dst, and reset (set to 0) the bit in dst that corresponds to the lowest set bit in a.
/// </summary>
/// <remarks>
/// **** blsr r32, r32
/// </remarks>
/// <param name="a">32-bit integer</param>
/// <returns>32-bit integer</returns>
[DebuggerStepThrough]
publicstaticuintblsr_u32(uinta)
{
return(a-1)&a;
}
/// <summary>
/// Copy all bits from unsigned 64-bit integer a to dst, and reset (set to 0) the bit in dst that corresponds to the lowest set bit in a.
/// </summary>
/// <remarks>
/// **** blsr r64, r64
/// </remarks>
/// <param name="a">64-bit integer</param>
/// <returns>64-bit integer</returns>
[DebuggerStepThrough]
publicstaticulongblsr_u64(ulonga)
{
return(a-1)&a;
}
/// <summary>
/// Count the number of trailing zero bits in unsigned 32-bit integer a, and return that count in dst.
/// </summary>
/// <remarks>
/// **** tzcnt r32, r32
/// </remarks>
/// <param name="a">32-bit integer</param>
/// <returns>32-bit integer</returns>
[DebuggerStepThrough]
publicstaticuinttzcnt_u32(uinta)
{
uintc=32;
a&=(uint)-(int)(a);
if(a!=0)c--;
if((a&0x0000FFFF)!=0)c-=16;
if((a&0x00FF00FF)!=0)c-=8;
if((a&0x0F0F0F0F)!=0)c-=4;
if((a&0x33333333)!=0)c-=2;
if((a&0x55555555)!=0)c-=1;
returnc;
}
/// <summary>
/// Count the number of trailing zero bits in unsigned 64-bit integer a, and return that count in dst.