dcoughlin added a comment. This looks good to me. It is very clean! But please add a comment in the places where you are assuming a two's complement value representation for signed integers. https://reviews.llvm.org/D39707