1
0
Fork 0

prefer the copy_n method for readability

This commit is contained in:
Kevin Matz 2022-12-02 13:09:18 -05:00
parent 11c6013a00
commit 6a977bbf01
2 changed files with 3 additions and 4 deletions

View File

@ -251,7 +251,7 @@ void Universe::setValue(const uint16_t start, const uint16_t footprint,
return;
null_start_mutex.lock();
std::copy(data, data + footprint, null_start_data.begin() + start);
std::copy_n(data, footprint, null_start_data.begin() + start);
null_start_mutex.unlock();
setStatus(DMX_ACTIVE);

View File

@ -273,10 +273,9 @@ void Universe::setValue (const uint16_t start, const uint16_t footprint,
active_data_slots_ = start + footprint + 1; // + start code
// get a copy of the current values
null_start_mutex.lock();
uint8_t og[footprint];
std::copy(std::begin(null_start_data) + start,
std::begin(null_start_data) + start + footprint, og);
null_start_mutex.lock();
std::copy_n(std::begin(null_start_data) + start, footprint, og);
null_start_mutex.unlock();
// data not changed!