Add some helper functions

Broke this out from https://github.com/rackerlabs/mimic/pull/105 so that PR can be a little smaller
As in, it literally does the `0 <= x < 256`, except in C. It definitely does not do the O(n) thing.