- /* output format: unsigned 16 bit little endian */
- signed short s = MAD_TO_SHORT(pmd->synth.pcm.samples[0][i]);
- fn->buf[fn->loaded++] = s & 0xff;
- fn->buf[fn->loaded++] = s >> 8;
+ int s = MAD_TO_SHORT(pmd->synth.pcm.samples[0][i]);
+ write_int16_host_endian(fn->buf + fn->loaded, s);
+ fn->loaded += 2;