In C#, what is analogous to the CHAR_BIT from C++? Fast Abs
<p>Does C# have something analogous to C++'s <a href="http://tigcc.ticalc.org/doc/limits.html#CHAR_BIT" rel="nofollow">CHAR_BIT</a>?</p>

<p><strong>Update:</strong><br>
Basically, I'm trying to compute abs without branching, here is the C++ version:</p>

<pre><code>// Compute the integer absolute value (abs) without branching

int v;           // we want to find the absolute value of v
unsigned int r;  // the result goes here 
int const mask = v &gt;&gt; sizeof(int) * CHAR_BIT - 1;

r = (v ^ mask) - mask;
</code></pre>

<p>Here is my C# version:</p>

<pre><code>private int Abs(int value)
{
    int mask = value &gt;&gt; sizeof(int) * 8 - 1;
    return ((value ^ mask) - mask);
}
</code></pre>

<p>Strangely, this also works:</p>

<pre><code>private int Abs(int value)
{
    int mask = value &gt;&gt; sizeof(int) * sizeof(byte) - 1;
    return ((value ^ mask) - mask);
}
</code></pre>
