| 77 | } |
| 78 | |
| 79 | uint8_t DetectUIntWidth(const uint64_t* values, int64_t length, uint8_t min_width) { |
| 80 | uint8_t width = min_width; |
| 81 | if (min_width < 8) { |
| 82 | auto p = values; |
| 83 | const auto end = p + length; |
| 84 | while (p <= end - 16) { |
| 85 | // This is probably SIMD-izable |
| 86 | auto u = p[0]; |
| 87 | auto v = p[1]; |
| 88 | auto w = p[2]; |
| 89 | auto x = p[3]; |
| 90 | u |= p[4]; |
| 91 | v |= p[5]; |
| 92 | w |= p[6]; |
| 93 | x |= p[7]; |
| 94 | u |= p[8]; |
| 95 | v |= p[9]; |
| 96 | w |= p[10]; |
| 97 | x |= p[11]; |
| 98 | u |= p[12]; |
| 99 | v |= p[13]; |
| 100 | w |= p[14]; |
| 101 | x |= p[15]; |
| 102 | p += 16; |
| 103 | width = ExpandedUIntWidth(u | v | w | x, width); |
| 104 | if (ARROW_PREDICT_FALSE(width == 8)) { |
| 105 | break; |
| 106 | } |
| 107 | } |
| 108 | if (p <= end - 8) { |
| 109 | auto u = p[0]; |
| 110 | auto v = p[1]; |
| 111 | auto w = p[2]; |
| 112 | auto x = p[3]; |
| 113 | u |= p[4]; |
| 114 | v |= p[5]; |
| 115 | w |= p[6]; |
| 116 | x |= p[7]; |
| 117 | p += 8; |
| 118 | width = ExpandedUIntWidth(u | v | w | x, width); |
| 119 | } |
| 120 | while (p < end) { |
| 121 | width = ExpandedUIntWidth(*p++, width); |
| 122 | } |
| 123 | } |
| 124 | return width; |
| 125 | } |
| 126 | |
| 127 | uint8_t DetectUIntWidth(const uint64_t* values, const uint8_t* valid_bytes, |
| 128 | int64_t length, uint8_t min_width) { |