a little optimization of gpu code