script: add functions to decode bitfield