Further code golf'd the encoder snippet into a single LoC