nBits to compact and compact to nBits conversion