generalized bit operations