Update pseudocode to better match CPU impl
Use xor where possible to reduce number of basic ops