compile on windows

This commit is contained in:
jed
2012-06-05 14:06:21 -07:00
parent 79cc39f902
commit 6559655218
7 changed files with 52 additions and 13 deletions

View File

@@ -102,4 +102,32 @@ DH* DH_der_load_hex(const std::string& strDer)
return DH_der_load(strBuf);
}
#ifdef WIN32
#define _WINSOCK_
#include <winsock2.h>
//#include "Winsock2.h"
//#include <windows.h>
// from: http://stackoverflow.com/questions/3022552/is-there-any-standard-htonl-like-function-for-64-bits-integers-in-c
// but we don't need to check the endianness
uint64_t htobe64(uint64_t value)
{
// The answer is 42
//static const int num = 42;
// Check the endianness
//if (*reinterpret_cast<const char*>(&num) == num)
//{
const uint32_t high_part = htonl(static_cast<uint32_t>(value >> 32));
const uint32_t low_part = htonl(static_cast<uint32_t>(value & 0xFFFFFFFFLL));
return (static_cast<uint64_t>(low_part) << 32) | high_part;
//} else
//{
// return value;
//}
}
#endif
// vim:ts=4