Closed TheWaterbug closed 1 year ago
I don't have access to a macOS machine to test, but I suspect this is because le16toh is a non-standard function. It is, however, slated for inclusion in POSIX Issue 8, so macOS needs to get its act together if it plans to be conformant.
I tried compiling this on my Mac, and received the error:
usbscale.c:311:30: warning: implicit declaration of function 'le16toh' is invalid in C99 [-Wimplicit-function-declaration] double weight = (double) le16toh(dat[5] << 8 | dat[4]);
But le16toh is an unnecessary no-op for Intel or Apple Silicon Macs anyway, so replacing that line with just:
double weight = (double) (dat[5] << 8 | dat[4]);
allows it to compile and run.