mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-07 04:53:44 +02:00
Linux/GCC fixes.
This commit is contained in:
parent
9ef780e05c
commit
4273d89373
4 changed files with 7 additions and 9 deletions
|
@ -264,7 +264,6 @@ public:
|
||||||
{ return ZT_IDENTITY_MARSHAL_SIZE_MAX; }
|
{ return ZT_IDENTITY_MARSHAL_SIZE_MAX; }
|
||||||
|
|
||||||
int marshal(uint8_t data[ZT_IDENTITY_MARSHAL_SIZE_MAX], bool includePrivate = false) const noexcept;
|
int marshal(uint8_t data[ZT_IDENTITY_MARSHAL_SIZE_MAX], bool includePrivate = false) const noexcept;
|
||||||
|
|
||||||
int unmarshal(const uint8_t *data, int len) noexcept;
|
int unmarshal(const uint8_t *data, int len) noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -635,8 +635,7 @@ bool Network::filterOutgoingPacket(
|
||||||
Member *membership;
|
Member *membership;
|
||||||
if (ztDest) {
|
if (ztDest) {
|
||||||
Map<Address, Member>::iterator mm(m_memberships.find(ztDest));
|
Map<Address, Member>::iterator mm(m_memberships.find(ztDest));
|
||||||
if (mm != m_memberships.end())
|
membership = (mm == m_memberships.end()) ? nullptr : &(mm->second);
|
||||||
membership = &(mm->second);
|
|
||||||
} else {
|
} else {
|
||||||
membership = nullptr;
|
membership = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -802,7 +802,7 @@ extern "C" const char *ZTT_general()
|
||||||
return "Identity test failed: v0 unmarshal";
|
return "Identity test failed: v0 unmarshal";
|
||||||
}
|
}
|
||||||
if (id != id2) {
|
if (id != id2) {
|
||||||
ZT_T_PRINTF("FAILED (v0 unmarshal !=)" ZT_EOL_S);
|
ZT_T_PRINTF("FAILED (v0 unmarshal %s != %s)" ZT_EOL_S, id.toString(true).c_str(), id2.toString(true).c_str());
|
||||||
return "Identity test failed: v0 unmarshal !=";
|
return "Identity test failed: v0 unmarshal !=";
|
||||||
}
|
}
|
||||||
ms = id.marshal(idm, false);
|
ms = id.marshal(idm, false);
|
||||||
|
|
|
@ -672,7 +672,7 @@ static ZT_INLINE void copy(void *dest, const void *src) noexcept
|
||||||
{
|
{
|
||||||
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
|
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
|
||||||
uintptr_t l = L;
|
uintptr_t l = L;
|
||||||
asm volatile ("cld ; rep movsb" : "+c"(l), "+S"(src), "+D"(dest));
|
__asm__ __volatile__ ("cld ; rep movsb" : "+c"(l), "+S"(src), "+D"(dest) :: "memory");
|
||||||
#else
|
#else
|
||||||
memcpy(dest, src, L);
|
memcpy(dest, src, L);
|
||||||
#endif
|
#endif
|
||||||
|
@ -688,7 +688,7 @@ static ZT_INLINE void copy(void *dest, const void *src) noexcept
|
||||||
static ZT_INLINE void copy(void *dest, const void *src, unsigned long len) noexcept
|
static ZT_INLINE void copy(void *dest, const void *src, unsigned long len) noexcept
|
||||||
{
|
{
|
||||||
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
|
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
|
||||||
asm volatile ("cld ; rep movsb" : "+c"(len), "+S"(src), "+D"(dest));
|
__asm__ __volatile__ ("cld ; rep movsb" : "+c"(len), "+S"(src), "+D"(dest) :: "memory");
|
||||||
#else
|
#else
|
||||||
memcpy(dest, src, len);
|
memcpy(dest, src, len);
|
||||||
#endif
|
#endif
|
||||||
|
@ -705,7 +705,7 @@ static ZT_INLINE void zero(void *dest) noexcept
|
||||||
{
|
{
|
||||||
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
|
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
|
||||||
uintptr_t l = L;
|
uintptr_t l = L;
|
||||||
asm volatile ("cld ; rep stosb" :"+c" (l), "+D" (dest) : "a" (0));
|
__asm__ __volatile__ ("cld ; rep stosb" :"+c" (l), "+D" (dest) : "a" (0) : "memory");
|
||||||
#else
|
#else
|
||||||
memset(dest, 0, L);
|
memset(dest, 0, L);
|
||||||
#endif
|
#endif
|
||||||
|
@ -720,7 +720,7 @@ static ZT_INLINE void zero(void *dest) noexcept
|
||||||
static ZT_INLINE void zero(void *dest, unsigned long len) noexcept
|
static ZT_INLINE void zero(void *dest, unsigned long len) noexcept
|
||||||
{
|
{
|
||||||
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
|
#if defined(ZT_ARCH_X64) && defined(__GNUC__)
|
||||||
asm volatile ("cld ; rep stosb" :"+c" (len), "+D" (dest) : "a" (0));
|
__asm__ __volatile__ ("cld ; rep stosb" :"+c" (len), "+D" (dest) : "a" (0) : "memory");
|
||||||
#else
|
#else
|
||||||
memset(dest, 0, len);
|
memset(dest, 0, len);
|
||||||
#endif
|
#endif
|
||||||
|
@ -735,7 +735,7 @@ static ZT_INLINE void zero(void *dest, unsigned long len) noexcept
|
||||||
* @param len Length of data
|
* @param len Length of data
|
||||||
* @return FNV1a checksum
|
* @return FNV1a checksum
|
||||||
*/
|
*/
|
||||||
uint32_t fnv1a32(const void *const data, const unsigned int len) noexcept;
|
uint32_t fnv1a32(const void *data, unsigned int len) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mix bits in a 64-bit integer (non-cryptographic, for hash tables)
|
* Mix bits in a 64-bit integer (non-cryptographic, for hash tables)
|
||||||
|
|
Loading…
Add table
Reference in a new issue