Codec implementations for various set types.
For portability and consistency between architectures, the size of the set must fit within a u32.