fix writing const arrays on big endian

Btw, th unanounced byte-swapping of valuse in the input array in
writeArray seems a bit dubious to me... It could too easily cause
unintentional memory damage. I just hope it is always called either with
data that is not used after that anymore or with a copy of the data.

Change-Id: Ica0e9ea16cd101fe87d7e0a8fa696911769e0654