MCPcopy Create free account
hub / github.com/bytedance/bolt / set

Method set

bolt/type/StringView.h:77–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 }
76
77 void set(const char* data, int32_t len) {
78 BOLT_CHECK_GE(len, 0);
79 BOLT_DCHECK(data || len == 0);
80 size_ = len;
81 if (isInline()) {
82 // Zero the inline part.
83 // this makes sure that inline strings can be compared for equality with 2
84 // int64 compares.
85 memset(prefix_, 0, kPrefixSize);
86 if (size_ == 0) {
87 return;
88 }
89 // small string: inlined. Zero the last 8 bytes first to allow for whole
90 // word comparison.
91 value_.data = nullptr;
92 memcpy(prefix_, data, size_);
93 } else {
94 // large string: store pointer
95 memcpy(prefix_, data, kPrefixSize);
96 value_.data = data;
97 }
98 }
99
100 static StringView makeInline(std::string str) {
101 BOLT_DCHECK(isInline(str.size()));

Callers 9

genTpchOrdersFunction · 0.45
genTpchLineItemFunction · 0.45
genTpchPartFunction · 0.45
genTpchSupplierFunction · 0.45
genTpchPartSuppFunction · 0.45
genTpchCustomerFunction · 0.45
genTpchNationFunction · 0.45
genTpchRegionFunction · 0.45
testBytesMethod · 0.45

Calls 2

memsetFunction · 0.85
memcpyFunction · 0.85

Tested by

no test coverage detected