title: What is this variable-length integer encoding?
body: <p>I am documenting an old file format and have stumped myself with the following issue. </p>
  
  <p>It seems to be that integers are variable-length encoded, with numbers &lt;= <code>0x7F</code> encoded in a single byte, but >= <code>0x80</code> are encoded in two bytes. An example set of integers and their encoded counterparts:</p>
  
  <ul>
  <li><code>0x390</code> is encoded as <code>0x9007</code></li>
  <li><code>0x150</code> is encoded as <code>0xD002</code></li>
  <li><code>0x82</code> is encoded as <code>0x8201</code></li>
  <li><code>0x89</code> is encoded as <code>0x8901</code></li>
  </ul>
  
  <p>I have yet to come across any numbers that are larger than <code>0xFFFF</code>, so I can't be sure if/how they are encoded. For the life of me, I can't work out the pattern here. Any ideas?</p>