Is it possible to use SIMD instruction for replace?
问题 I have vector of int and I need to find and replace some elements with specific value. Both of them are the same . For example: replace 4 to 8 for all elements. I'm trying direct memory access in loop in c++. But it still to slow for me. Update: I'm working with OpenCV Mat object on x86 : for (int i = 0; i < labels.rows; ++i) { for (int j = 0; j < labels.cols; ++j) { int& label = labels.at<int>(i, j); if (label == oldValue) { label = newValue; } } } Mat.at() function just return value by