Various optimizations in util.asm