code: def idaunpack(buf):
      
      buf = bytearray(buf)
  
      def nextval(o):
          val = buf[o] ; o += 1
          if val == 0xff:  # 32 bit value
              val, = struct.unpack_from(">L", buf, o)
              o += 4
              return val, o
          if val < 0x80:  # 7 bit value
              return val, o
          val <<= 8
          val |= buf[o] ; o += 1
          if val < 0xc000:  # 14 bit value
              return val & 0x3fff, o
  
          # 29 bit value
          val <<= 8
          val |= buf[o] ; o += 1
          val <<= 8
          val |= buf[o] ; o += 1
          return val & 0x1fffffff, o
  
      values = []
      o = 0
      while o < len(buf):
          val, o = nextval(o)
          values.append(val)
      return values
docs: Special data packing format, used in struct definitions, and .id2 files
  
      sdk functions: pack_dd etc.