Chunk all explicit bulk work; allocator internals are not a polling API. */
| 682 | |
| 683 | /* Chunk all explicit bulk work; allocator internals are not a polling API. */ |
| 684 | static bool cv2_copy(cv2_context_t *ctx, void *to, const void *from, size_t length) { |
| 685 | unsigned char *dst = to; |
| 686 | const unsigned char *src = from; |
| 687 | size_t at = 0; |
| 688 | while (at < length) { |
| 689 | if (!cv2_poll(ctx)) |
| 690 | return false; |
| 691 | size_t chunk = length - at; |
| 692 | if (chunk > 4096) |
| 693 | chunk = 4096; |
| 694 | memcpy(dst + at, src + at, chunk); |
| 695 | at += chunk; |
| 696 | } |
| 697 | return cv2_poll(ctx); |
| 698 | } |
| 699 | |
| 700 | static bool cv2_zero(cv2_context_t *ctx, void *memory, size_t length) { |
| 701 | unsigned char *bytes = memory; |
no test coverage detected