optimize bit operation