diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-12-15 11:03:20 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-12-15 11:03:20 -0800 |
| commit | 060870462606f82d3a9b0fe6aca87f8a5de8705e (patch) | |
| tree | 2001ea775c3a8b65c756d64fff88c664c609feb3 /node/Node.cpp | |
| parent | cb8e7b4d5e3cb4c5b79ccb9f74c161182222daca (diff) | |
| download | infinitytier-060870462606f82d3a9b0fe6aca87f8a5de8705e.tar.gz infinitytier-060870462606f82d3a9b0fe6aca87f8a5de8705e.zip | |
Some micro-optimizations, including a memcpy that is faster than Linux for most distro/compiler versions.
Diffstat (limited to 'node/Node.cpp')
| -rw-r--r-- | node/Node.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index ef8925d5..8d8f5ca0 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -66,7 +66,7 @@ Node::Node(void *uptr,void *tptr,const struct ZT_Node_Callbacks *callbacks,int64 { if (callbacks->version != 0) throw ZT_EXCEPTION_INVALID_ARGUMENT; - memcpy(&_cb,callbacks,sizeof(ZT_Node_Callbacks)); + ZT_FAST_MEMCPY(&_cb,callbacks,sizeof(ZT_Node_Callbacks)); // Initialize non-cryptographic PRNG from a good random source Utils::getSecureRandom((void *)_prngState,sizeof(_prngState)); @@ -441,7 +441,7 @@ ZT_PeerList *Node::peers() const SharedPtr<Path> bestp(pi->second->getBestPath(_now,false)); p->pathCount = 0; for(std::vector< SharedPtr<Path> >::iterator path(paths.begin());path!=paths.end();++path) { - memcpy(&(p->paths[p->pathCount].address),&((*path)->address()),sizeof(struct sockaddr_storage)); + ZT_FAST_MEMCPY(&(p->paths[p->pathCount].address),&((*path)->address()),sizeof(struct sockaddr_storage)); p->paths[p->pathCount].lastSend = (*path)->lastOut(); p->paths[p->pathCount].lastReceive = (*path)->lastIn(); p->paths[p->pathCount].trustedPathId = RR->topology->getOutboundPathTrust((*path)->address()); |
