MCPcopy Create free account
hub / github.com/ElementsProject/elements / set_vch

Method set_vch

src/test/scriptnum10.h:161–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159
160private:
161 static int64_t set_vch(const std::vector<unsigned char>& vch)
162 {
163 if (vch.empty())
164 return 0;
165
166 int64_t result = 0;
167 for (size_t i = 0; i != vch.size(); ++i)
168 result |= static_cast<int64_t>(vch[i]) << 8*i;
169
170 // If the input vector's most significant byte is 0x80, remove it from
171 // the result's msb and return a negative.
172 if (vch.back() & 0x80)
173 return -((int64_t)(result & ~(0x80ULL << (8 * (vch.size() - 1)))));
174
175 return result;
176 }
177
178 int64_t m_value;
179};

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected