support writing primitives packed; TODO code for packed size calculation currently generated twice