From 736f8bd0cad447c2ef4c085a54971f5d64090377 Mon Sep 17 00:00:00 2001 From: Yonghye Kwon Date: Wed, 25 Mar 2020 00:28:29 +0900 Subject: [PATCH 1/2] 4x faster getError function removed condition state so that we can reduce the stall caused by the branch statement. --- c++/src/dynamixel_sdk/group_bulk_read.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/c++/src/dynamixel_sdk/group_bulk_read.cpp b/c++/src/dynamixel_sdk/group_bulk_read.cpp index bcea7551..1f150231 100644 --- a/c++/src/dynamixel_sdk/group_bulk_read.cpp +++ b/c++/src/dynamixel_sdk/group_bulk_read.cpp @@ -232,14 +232,5 @@ bool GroupBulkRead::getError(uint8_t id, uint8_t* error) // TODO : check protocol version, last_result_, data_list // if (last_result_ == false || error_list_.find(id) == error_list_.end()) - error[0] = error_list_[id][0]; - - if (error[0] != 0) - { - return true; - } - else - { - return false; - } -} \ No newline at end of file + return error[0] = error_list_[id][0]; +} From cb56ac6c5dfbee568a66e047f72170f142d8ff61 Mon Sep 17 00:00:00 2001 From: Yonghye Kwon Date: Wed, 25 Mar 2020 00:30:25 +0900 Subject: [PATCH 2/2] 4x faster getError member function of GroupSyncRead Class removed condition state so that we can reduce the stall caused by the branch statement. --- c++/src/dynamixel_sdk/group_sync_read.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/c++/src/dynamixel_sdk/group_sync_read.cpp b/c++/src/dynamixel_sdk/group_sync_read.cpp index f392943b..3a77f58a 100644 --- a/c++/src/dynamixel_sdk/group_sync_read.cpp +++ b/c++/src/dynamixel_sdk/group_sync_read.cpp @@ -201,14 +201,5 @@ bool GroupSyncRead::getError(uint8_t id, uint8_t* error) // TODO : check protocol version, last_result_, data_list // if (ph_->getProtocolVersion() == 1.0 || last_result_ == false || error_list_.find(id) == error_list_.end()) - error[0] = error_list_[id][0]; - - if (error[0] != 0) - { - return true; - } - else - { - return false; - } -} \ No newline at end of file + return error[0] = error_list_[id][0]; +}