Add some helper functions

Broke this out from https://github.com/rackerlabs/mimic/pull/105 so that PR can be a little smaller
I meant to suggest `x <= 0 < 256` but didn't catch the bug :) (Also, I think `xrange(256)` is clever about bounds checking, too.)