android: Templatize the htons family of functions

This allows the file to not require compilation.