Fix arithmetic coding err

in encode, the last x2 should write from high to low