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

Function ExpandedUIntWidth

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

Check if we would need to expand the underlying storage type

Source from the content-addressed store, hash-verified

61
62// Check if we would need to expand the underlying storage type
63static inline uint8_t ExpandedUIntWidth(uint64_t val, uint8_t current_width) {
64 // Optimize for the common case where width doesn't change
65 if (ARROW_PREDICT_TRUE(val <= max_uints[current_width])) {
66 return current_width;
67 }
68 if (current_width == 1 && val <= max_uint8) {
69 return 1;
70 } else if (current_width <= 2 && val <= max_uint16) {
71 return 2;
72 } else if (current_width <= 4 && val <= max_uint32) {
73 return 4;
74 } else {
75 return 8;
76 }
77}
78
79uint8_t DetectUIntWidth(const uint64_t* values, int64_t length, uint8_t min_width) {
80 uint8_t width = min_width;

Callers 1

DetectUIntWidthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected