tests compile under g++ now; fix casts, stack allocated arrays, macro issues, some sign problems