Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_memory_utils.hh
| Context not available. | |||||
| #include <new> | #include <new> | ||||
| #include <type_traits> | #include <type_traits> | ||||
| #include "BLI_task.hh" | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| Context not available. | |||||
| return; | return; | ||||
| } | } | ||||
| for (int64_t i = 0; i < n; i++) { | if (n >= 64) { | ||||
| ptr[i].~T(); | const int grain_size = std::max(32, (int)(n / 128)); | ||||
| parallel_for(IndexRange(n), grain_size, [&](IndexRange range) { | |||||
| for (int64_t i : range) { | |||||
| ptr[i].~T(); | |||||
| } | |||||
| }); | |||||
| } | |||||
| else { | |||||
| for (int64_t i = 0; i < n; i++) { | |||||
| ptr[i].~T(); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| { | { | ||||
| BLI_assert(n >= 0); | BLI_assert(n >= 0); | ||||
| for (int64_t i = 0; i < n; i++) { | if (n >= 64) { | ||||
| dst[i] = src[i]; | const int grain_size = std::max(32, (int)(n / 128)); | ||||
| parallel_for(IndexRange(n), grain_size, [&](IndexRange range) { | |||||
| for (int64_t i : range) { | |||||
| dst[i] = src[i]; | |||||
| } | |||||
| }); | |||||
| } | |||||
| else { | |||||
| for (int64_t i = 0; i < n; i++) { | |||||
| dst[i] = src[i]; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| { | { | ||||
| BLI_assert(n >= 0); | BLI_assert(n >= 0); | ||||
| for (int64_t i = 0; i < n; i++) { | if (n >= 64) { | ||||
| dst[i] = std::move(src[i]); | const int grain_size = std::max(32, (int)(n / 128)); | ||||
| parallel_for(IndexRange(n), grain_size, [&](IndexRange range) { | |||||
| for (int64_t i : range) { | |||||
| dst[i] = std::move(src[i]); | |||||
| } | |||||
| }); | |||||
| } | |||||
| else { | |||||
| for (int64_t i = 0; i < n; i++) { | |||||
| dst[i] = std::move(src[i]); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| { | { | ||||
| BLI_assert(n >= 0); | BLI_assert(n >= 0); | ||||
| for (int64_t i = 0; i < n; i++) { | if (n >= 64) { | ||||
| dst[i] = value; | const int grain_size = std::max(32, (int)(n / 128)); | ||||
| parallel_for(IndexRange(n), grain_size, [&](IndexRange range) { | |||||
| for (int64_t i : range) { | |||||
| dst[i] = value; | |||||
| } | |||||
| }); | |||||
| } | |||||
| else { | |||||
| for (int64_t i = 0; i < n; i++) { | |||||
| dst[i] = value; | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||