add an extended getbits function