byte + byte = int... why?
<p>Looking at this C# code...</p>

<pre><code>byte x = 1;
byte y = 2;
byte z = x + y;   // ERROR: Cannot implicitly convert type 'int' to 'byte'
</code></pre>

<p>The result of any math performed on byte (or short) types is implicitly cast back to an integer. The solution is to explicitly cast the result back to a byte, so...</p>

<pre><code>byte z = (byte)(x + y);   // works
</code></pre>

<p>What I am wondering is why? Is it architectural? Philosophical? </p>

<p><strong>We have:</strong></p>

<ul>
<li>int + int = int   </li>
<li>long + long = long</li>
<li>float + float = float</li>
<li>double + double = double</li>
</ul>

<p><strong>So why not:</strong></p>

<ul>
<li>byte + byte = byte</li>
<li>short + short = short ?</li>
</ul>

<p><strong>A bit of background:</strong></p>

<p><em>I am performing a long list of calculations on "small numbers" (i.e. &lt; 8) and storing the intermediate results in a large array. Using a <strong>byte array</strong> (instead of an int array) <strong>is faster</strong> (because of cache hits). But the extensive byte-casts spread through the code make it that much more unreadable.</em></p>
