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

Function read_bigsize

devtools/gossmap-compress.c:102–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102static u64 read_bigsize(gzFile inf)
103{
104 u64 val;
105 u8 buf[BIGSIZE_MAX_LEN];
106
107 if (gzread(inf, buf, 1) != 1)
108 errx(1, "Reading bigsize");
109
110 switch (buf[0]) {
111 case 0xfd:
112 if (gzread(inf, buf+1, 2) != 2)
113 errx(1, "Reading bigsize");
114 break;
115 case 0xfe:
116 if (gzread(inf, buf+1, 4) != 4)
117 errx(1, "Reading bigsize");
118 break;
119 case 0xff:
120 if (gzread(inf, buf+1, 8) != 8)
121 errx(1, "Reading bigsize");
122 break;
123 }
124
125 if (bigsize_get(buf, sizeof(buf), &val) == 0)
126 errx(1, "Bad bigsize");
127 return val;
128}
129
130static int cmp_u64(const u64 *a,
131 const u64 *b,

Callers 3

read_templateFunction · 0.85
read_valFunction · 0.85
mainFunction · 0.85

Calls 3

gzreadFunction · 0.85
errxFunction · 0.85
bigsize_getFunction · 0.50

Tested by

no test coverage detected