title: Packing and unpacking a Cardinal into four bytes
body: <p>I have to pack and unpack a Cardinal into four one-byte fields (<strong>in Delphi 2010</strong>).</p>
  
  <p>I'm doing this across all the pixels of a large image, so I need it to be fast!</p>
  
  <p>Can anyone show me how to write these two functions?  (The const and out keywords are just for clarity. If they interfere with inline assembly, then I can remove them.)</p>
  
  <pre><code>procedure FromCardinalToBytes( const aInput: Cardinal;
                                 out   aByte1: Byte;
                                 out   aByte2: Byte;
                                 out   aByte3: Byte;
                                 out   aByte4: Byte); inline;
  
  function FromBytesToCardinal( const aByte1: Byte;
                                const aByte2: Byte;
                                const aByte3: Byte;
                                const aByte4: Byte):Cardinal; inline;
  </code></pre>