added support for %, optimize readOffset to remove unnecessary madd