diff --git a/include/ps/internal/assign_op.h b/include/ps/internal/assign_op.h index 834f523e..6f0a04ae 100644 --- a/include/ps/internal/assign_op.h +++ b/include/ps/internal/assign_op.h @@ -21,21 +21,21 @@ enum AssignOp { }; /** - * \brief return an assignment function: right op= left + * \brief return an assignment function: rhs op= lhs */ template inline void AssignFunc(const T& lhs, AssignOp op, T* rhs) { switch (op) { case ASSIGN: - *right = left; break; + *rhs = lhs; break; case PLUS: - *right += left; break; + *rhs += lhs; break; case MINUS: - *right -= left; break; + *rhs -= lhs; break; case TIMES: - *right *= left; break; + *rhs *= lhs; break; case DIVIDE: - *right /= left; break; + *rhs /= lhs; break; default: LOG(FATAL) << "use AssignOpInt.."; } @@ -49,21 +49,21 @@ template inline void AssignFuncInt(const T& lhs, AssignOp op, T* rhs) { switch (op) { case ASSIGN: - *right = left; break; + *rhs = lhs; break; case PLUS: - *right += left; break; + *rhs += lhs; break; case MINUS: - *right -= left; break; + *rhs -= lhs; break; case TIMES: - *right *= left; break; + *rhs *= lhs; break; case DIVIDE: - *right /= left; break; + *rhs /= lhs; break; case AND: - *right &= left; break; + *rhs &= lhs; break; case OR: - *right |= left; break; + *rhs |= lhs; break; case XOR: - *right ^= left; break; + *rhs ^= lhs; break; } } diff --git a/include/ps/internal/parallel_kv_match.h b/include/ps/internal/parallel_kv_match.h index bf5ab0b7..fb719b88 100644 --- a/include/ps/internal/parallel_kv_match.h +++ b/include/ps/internal/parallel_kv_match.h @@ -30,7 +30,7 @@ template void ParallelOrderedMatch( const K* src_key, const K* src_key_end, const V* src_val, const K* dst_key, const K* dst_key_end, V* dst_val, - int k, AsOp op, size_t grainsize, size_t* n) { + int k, AssignOp op, size_t grainsize, size_t* n) { size_t src_len = std::distance(src_key, src_key_end); size_t dst_len = std::distance(dst_key, dst_key_end); if (dst_len == 0 || src_len == 0) return; @@ -46,7 +46,7 @@ void ParallelOrderedMatch( } else { if (!(*dst_key < *src_key)) { for (int i = 0; i < k; ++i) { - AssignOp(dst_val[i], src_val[i], op); + AssignFunc(dst_val[i], src_val[i], op); } ++src_key; src_val += k; *n += k; diff --git a/src/van.cc b/src/van.cc index 44b07b3f..129e020f 100644 --- a/src/van.cc +++ b/src/van.cc @@ -18,7 +18,7 @@ namespace ps { // don't send heartbeast in default. because if the scheduler received a // heartbeart signal from a node before connected to that node, then it could be // problem. -const static int kDefaultHeartbeatInterval = 0; +static const int kDefaultHeartbeatInterval = 0; Van* Van::Create(const std::string& type) { if (type == "zmq") { @@ -140,7 +140,8 @@ int Van::Send(const Message& msg) { void Van::Receiving() { const char* heartbeat_timeout_val = Environment::Get()->find("PS_HEARTBEAT_TIMEOUT"); - const int heartbeat_timeout = heartbeat_timeout_val ? atoi(heartbeat_timeout_val) : kDefaultHeartbeatInterval; + const int heartbeat_timeout = heartbeat_timeout_val ? atoi(heartbeat_timeout_val) + : kDefaultHeartbeatInterval; Meta nodes; // for scheduler usage while (true) { Message msg;