fix endian test
To be honest, I don't remember exactly the use case that broke the previous version.
Perhaps it was on the Raspberry Pi (can't test right now).  In any case, after much
research I found that there was a subtle problem with the old endian test, and that
everyone on the net recommends this new idiom.  Sorry that I don't remember the details.
remove unused parameters to avoid compiler warnings with -Wextra
use size_t for sizes
use portable data types from stdint.h
proper memory management; use std::vector rather than arrays
Now it is no longer necessary to manually delete data.
for 1-d data, can just pass vector; some c++11 stuff