| 343 | // |
| 344 | |
| 345 | inline void DoSplitStreams(const uint8_t* src, int width, int64_t nvalues, |
| 346 | uint8_t** dest_streams) { |
| 347 | // Value empirically chosen to provide the best performance on the author's machine |
| 348 | constexpr int kBlockSize = 32; |
| 349 | |
| 350 | while (nvalues >= kBlockSize) { |
| 351 | for (int stream = 0; stream < width; ++stream) { |
| 352 | uint8_t* dest = dest_streams[stream]; |
| 353 | for (int i = 0; i < kBlockSize; i += 8) { |
| 354 | uint64_t a = src[stream + i * width]; |
| 355 | uint64_t b = src[stream + (i + 1) * width]; |
| 356 | uint64_t c = src[stream + (i + 2) * width]; |
| 357 | uint64_t d = src[stream + (i + 3) * width]; |
| 358 | uint64_t e = src[stream + (i + 4) * width]; |
| 359 | uint64_t f = src[stream + (i + 5) * width]; |
| 360 | uint64_t g = src[stream + (i + 6) * width]; |
| 361 | uint64_t h = src[stream + (i + 7) * width]; |
| 362 | #if ARROW_LITTLE_ENDIAN |
| 363 | uint64_t r = a | (b << 8) | (c << 16) | (d << 24) | (e << 32) | (f << 40) | |
| 364 | (g << 48) | (h << 56); |
| 365 | #else |
| 366 | uint64_t r = (a << 56) | (b << 48) | (c << 40) | (d << 32) | (e << 24) | |
| 367 | (f << 16) | (g << 8) | h; |
| 368 | #endif |
| 369 | arrow::util::SafeStore(&dest[i], r); |
| 370 | } |
| 371 | dest_streams[stream] += kBlockSize; |
| 372 | } |
| 373 | src += width * kBlockSize; |
| 374 | nvalues -= kBlockSize; |
| 375 | } |
| 376 | |
| 377 | // Epilog |
| 378 | for (int stream = 0; stream < width; ++stream) { |
| 379 | uint8_t* dest = dest_streams[stream]; |
| 380 | for (int64_t i = 0; i < nvalues; ++i) { |
| 381 | dest[i] = src[stream + i * width]; |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | inline void DoMergeStreams(const uint8_t** src_streams, int width, int64_t nvalues, |
| 387 | uint8_t* dest) { |
no outgoing calls
no test coverage detected