MCPcopy Create free account
hub / github.com/citp/BlockSci / set_vch

Method set_vch

src/internal/bitcoin_script.hpp:351–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349
350 private:
351 static int64_t set_vch(const std::vector<unsigned char>& vch)
352 {
353 if (vch.empty())
354 return 0;
355
356 int64_t result = 0;
357 for (size_t i = 0; i != vch.size(); ++i)
358 result |= static_cast<int64_t>(vch[i]) << 8*i;
359
360 // If the input vector's most significant byte is 0x80, remove it from
361 // the result's msb and return a negative.
362 if (vch.back() & 0x80)
363 return -(static_cast<int64_t>(result & ~(0x80LL << (8 * (vch.size() - 1)))));
364
365 return result;
366 }
367
368 int64_t m_value;
369 };

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected