Add Windows specific code
This commit is contained in:
28
src/sha1.cpp
28
src/sha1.cpp
@@ -28,9 +28,35 @@
|
||||
/* this is only to get definitions for memcpy(), ntohl() and htonl() */
|
||||
//#include "../git-compat-util.h"
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "sha1.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <arpa/inet.h>
|
||||
#else
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
|
||||
#define htons(n) (n)
|
||||
#define ntohs(n) (n)
|
||||
#define htonl(n) (n)
|
||||
#define ntohl(n) (n)
|
||||
|
||||
#else
|
||||
|
||||
#define htons(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8))
|
||||
#define ntohs(n) (((((unsigned short)(n) & 0xFF)) << 8) | (((unsigned short)(n) & 0xFF00) >> 8))
|
||||
|
||||
#define htonl(n) (((((unsigned long)(n) & 0xFF)) << 24) | \
|
||||
((((unsigned long)(n) & 0xFF00)) << 8) | \
|
||||
((((unsigned long)(n) & 0xFF0000)) >> 8) | \
|
||||
((((unsigned long)(n) & 0xFF000000)) >> 24))
|
||||
|
||||
#define ntohl(n) (((((unsigned long)(n) & 0xFF)) << 24) | \
|
||||
((((unsigned long)(n) & 0xFF00)) << 8) | \
|
||||
((((unsigned long)(n) & 0xFF0000)) >> 8) | \
|
||||
((((unsigned long)(n) & 0xFF000000)) >> 24))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user