提交 5e047028 编写于 作者: L lihui

[#1054]

上级 d9a3b9da
......@@ -71,20 +71,20 @@ int taosSetSockOpt(int socketfd, int level, int optname, void *optval, int optle
}
// add
// char interlocked_add_fetch_8(char volatile* ptr, char val) {
// return _InterlockedExchangeAdd8(ptr, val) + val;
// }
// short interlocked_add_fetch_16(short volatile* ptr, short val) {
// return _InterlockedExchangeAdd16(ptr, val) + val;
// }
char interlocked_add_fetch_8(char volatile* ptr, char val) {
return __sync_fetch_and_add(ptr, val) + val;
#ifdef _TD_GO_DLL_
return __sync_fetch_and_add(ptr, val) + val;
#else
return _InterlockedExchangeAdd8(ptr, val) + val;
#endif
}
short interlocked_add_fetch_16(short volatile* ptr, short val) {
return __sync_fetch_and_add(ptr, val) + val;
#ifdef _TD_GO_DLL_
return __sync_fetch_and_add(ptr, val) + val;
#else
return _InterlockedExchangeAdd16(ptr, val) + val;
#endif
}
long interlocked_add_fetch_32(long volatile* ptr, long val) {
......@@ -96,13 +96,15 @@ __int64 interlocked_add_fetch_64(__int64 volatile* ptr, __int64 val) {
}
// and
// char interlocked_and_fetch_8(char volatile* ptr, char val) {
// return _InterlockedAnd8(ptr, val) & val;
// }
#ifndef _TD_GO_DLL_
char interlocked_and_fetch_8(char volatile* ptr, char val) {
return _InterlockedAnd8(ptr, val) & val;
}
// short interlocked_and_fetch_16(short volatile* ptr, short val) {
// return _InterlockedAnd16(ptr, val) & val;
// }
short interlocked_and_fetch_16(short volatile* ptr, short val) {
return _InterlockedAnd16(ptr, val) & val;
}
#endif
long interlocked_and_fetch_32(long volatile* ptr, long val) {
return _InterlockedAnd(ptr, val) & val;
......@@ -136,14 +138,15 @@ __int64 interlocked_fetch_and_64(__int64 volatile* ptr, __int64 val) {
#endif
// or
// char interlocked_or_fetch_8(char volatile* ptr, char val) {
// return _InterlockedOr8(ptr, val) | val;
// }
// short interlocked_or_fetch_16(short volatile* ptr, short val) {
// return _InterlockedOr16(ptr, val) | val;
// }
#ifndef _TD_GO_DLL_
char interlocked_or_fetch_8(char volatile* ptr, char val) {
return _InterlockedOr8(ptr, val) | val;
}
short interlocked_or_fetch_16(short volatile* ptr, short val) {
return _InterlockedOr16(ptr, val) | val;
}
#endif
long interlocked_or_fetch_32(long volatile* ptr, long val) {
return _InterlockedOr(ptr, val) | val;
}
......@@ -176,14 +179,15 @@ __int64 interlocked_fetch_or_64(__int64 volatile* ptr, __int64 val) {
#endif
// xor
// char interlocked_xor_fetch_8(char volatile* ptr, char val) {
// return _InterlockedXor8(ptr, val) ^ val;
// }
// short interlocked_xor_fetch_16(short volatile* ptr, short val) {
// return _InterlockedXor16(ptr, val) ^ val;
// }
#ifndef _TD_GO_DLL_
char interlocked_xor_fetch_8(char volatile* ptr, char val) {
return _InterlockedXor8(ptr, val) ^ val;
}
short interlocked_xor_fetch_16(short volatile* ptr, short val) {
return _InterlockedXor16(ptr, val) ^ val;
}
#endif
long interlocked_xor_fetch_32(long volatile* ptr, long val) {
return _InterlockedXor(ptr, val) ^ val;
}
......@@ -410,6 +414,7 @@ char *strndup(const char *s, size_t n) {
void taosSetCoreDump() {}
#ifdef _TD_GO_DLL_
int64_t str2int64(char *str) {
char *endptr = NULL;
return strtoll(str, &endptr, 10);
......@@ -418,4 +423,5 @@ int64_t str2int64(char *str) {
uint64_t htonll(uint64_t val)
{
return (((uint64_t) htonl(val)) << 32) + htonl(val >> 32);
}
\ No newline at end of file
}
#endif
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册