Windows seems to need stdint.h for UINT16_MAX.

Sorry about the flood of commits, I will rebase the branch once Windows
is happy and there are no further compilation issues.