trabucayre/openFPGALoader#38 minor adjustments for MinGW build - use memset instead of bzero, errno_t may be replaced by int, provide ad-hoc ntohs on windows (alternative is link against winsock)

This commit is contained in:
Ed Bordin
2020-07-25 12:55:41 +10:00
parent 3f4086ec89
commit d24c63ec8a
10 changed files with 24 additions and 17 deletions
+9
View File
@@ -2,7 +2,16 @@
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#ifndef _WIN32
#include <arpa/inet.h>
#else
// WARNING: this will be incorrect on ARM-based windows platforms
// that are big-endian, but the rest of this code has not been tested for
// those platforms anyway.
uint16_t ntohs(uint16_t netshort) {
return ((netshort & 0xFF) << 8) | ((netshort & 0xFF00) >> 8);
}
#endif
using namespace std;