MCPcopy Create free account
hub / github.com/IoLanguage/io / BStream_writeTag

Function BStream_writeTag

libs/basekit/source/BStream.c:245–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243// tagged writing --------------------------------------
244
245void BStream_writeTag(BStream *self, unsigned int t, unsigned int b,
246 unsigned int a) {
247 BStreamTag tag;
248 tag.isArray = a;
249 tag.type = t;
250 tag.byteCount = b;
251
252 {
253 unsigned char c = BStreamTag_asUnsignedChar(&tag);
254 BStreamTag tag2 = BStreamTag_FromUnsignedChar(c);
255
256 if (tag2.isArray != tag.isArray || tag2.type != tag.type ||
257 tag2.byteCount != tag.byteCount) {
258 printf("tags don't match\n");
259 exit(-1);
260 }
261
262 BStream_writeUint8_(self, c);
263 }
264}
265
266void BStream_writeTaggedUint8_(BStream *self, uint8_t v) {
267 BStream_writeTag(self, BSTREAM_UNSIGNED_INT, 1, 0);

Calls 3

BStream_writeUint8_Function · 0.85

Tested by

no test coverage detected