Fix #7

Use binary manipulation on negative values where the encoding length is
a power of 2