XBF - arbitrary-length endian-aware bit field manipulation