core: Add bit swap helpers.