Move AVR serialization logic, add unit test

This PR includes and supercedes #139.

As an additional obvious benefit, the serialization logic for Float64, if used, will appear only once in the binary, rather than once per field using it. If unused, it will be optimized away.

@mikeferguson, @PaulBouchier, @mgerdzhev, this look okay to you guys?