MCPcopy Create free account
hub / github.com/ElementsProject/lightning / towire_tlv_uint

Function towire_tlv_uint

wire/towire.c:42–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42static void towire_tlv_uint(u8 **pptr, u64 v)
43{
44 u8 bytes[8];
45 size_t num_zeroes;
46 be64 val;
47
48 val = cpu_to_be64(v);
49 BUILD_ASSERT(sizeof(val) == sizeof(bytes));
50 memcpy(bytes, &val, sizeof(bytes));
51
52 for (num_zeroes = 0; num_zeroes < sizeof(bytes); num_zeroes++)
53 if (bytes[num_zeroes] != 0)
54 break;
55
56 towire(pptr, bytes + num_zeroes, sizeof(bytes) - num_zeroes);
57}
58
59void towire_tu16(u8 **pptr, u16 v)
60{

Callers 3

towire_tu16Function · 0.85
towire_tu32Function · 0.85
towire_tu64Function · 0.85

Calls 2

cpu_to_be64Function · 0.85
towireFunction · 0.70

Tested by

no test coverage detected