Clean up pull request, and add tests.

I did a few things here:

 * Removed tab characters
 * Improved efficiency a bit with inlined private methods
 * Removed "dangerous" intToByte and longToByte
 * Added ScalaCheck test
 * Fixed a bug that I found

I decided that intToByte and longToByte were "dangerous" since there
aren't very many "correct" ways of calling them (only 4/8 valid second
arguments, respectively). Also, by using the new private inlined
methods I can avoid doing a bunch of arithmetic.

Thanks to flavuit for the pull request and the efficiency improvements!