MCPcopy Create free account
hub / github.com/apache/arrow / DetectUIntWidth

Function DetectUIntWidth

cpp/src/arrow/util/int_util.cc:79–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79uint8_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
127uint8_t DetectUIntWidth(const uint64_t* values, const uint8_t* valid_bytes,
128 int64_t length, uint8_t min_width) {

Callers 5

typeMethod · 0.85
AppendValuesInternalMethod · 0.85
CheckUIntWidthFunction · 0.85
DetectUIntWidthNoNullsFunction · 0.85
DetectUIntWidthNullsFunction · 0.85

Calls 1

ExpandedUIntWidthFunction · 0.85

Tested by 1

CheckUIntWidthFunction · 0.68