Conversation

Very cool! The author of OllyDbg implemented a similar (but different) algorithm in 2001 for backwards disassembly, check it out: ollydbg.de/srcdescr.htm#_
Quote Tweet
New blog post: "Parallelising Huffman decoding and x86 disassembly by synchronising non-self-synchronising prefix codes" dougallj.wordpress.com/2022/07/30/par
Show this thread
Screenshot of code:
  size_t find_sync_after(uint8_t *data, size_t offset) {
    uint64_t probes = (1ull << MAX_CODE_LENGTH) - 1;
    while (probes != 1) {
      uint64_t size = decode_length(data, offset);

      offset += 1;
      probes >>= 1;

      probes |= 1ull << (size - 1);

      offset += countTrailingZeros(probes);
      probes >>= countTrailingZeros(probes);
    }
    return offset;
  }