Forego updating sz in capn_write_mem

It is not used and we already validated the total buffer size
beforehand.
Add comments
Move initialization closer to use

Should make it a bit more readable, the variable is used before that
case as well but doesn't require the zero initialization in that case.
Use constants where possible

The hdr variable gets the same constants as value but it is easier to
understand that the constants are used than the hdr which needs to be
traced to the value it received.
Fix use of wrong offset in buffer

The header of packing is a single byte and nothing was written to the
first byte anyway.
Implement packed memory write

This uses the capn_deflate function.

The current use may get smaller packing than the maximum possible due to
the inability to peak around segments as it packs each segment on its
own. This saves time compared to copying everything into one place and
saves effort by not requiring to change the interface of capn_deflate to
support multiple different buffers.

It should be possible to make the capn_deflate state machine better to
handle the multiple buffers case too.