face_num and face_idx computation in packing kernels moved into if-else block to avoid register spilling.