+incore_add_sizek(Repodata *data, unsigned int sx)
+{
+ if (sx < (1 << 22))
+ incore_add_id(data, (Id)(sx << 10));
+ else
+ {
+ if ((sx >> 25) != 0)
+ {
+ incore_add_id(data, (Id)(sx >> 25));
+ data->incoredata[data->incoredatalen - 1] |= 128;
+ }
+ incore_add_id(data, (Id)((sx << 10) | 0x80000000));
+ data->incoredata[data->incoredatalen - 5] = (sx >> 18) | 128;
+ }
+}
+
+static void
+incore_add_ideof(Repodata *data, Id sx, int eof)
+{
+ unsigned int x = (unsigned int)sx;
+ unsigned char *dp;
+ /* make sure we have at least 5 bytes free */
+ if (data->incoredatafree < 5)
+ {
+ data->incoredata = solv_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK);
+ data->incoredatafree = INCORE_ADD_CHUNK;
+ }
+ dp = data->incoredata + data->incoredatalen;
+ if (x >= (1 << 13))
+ {
+ if (x >= (1 << 27))
+ *dp++ = (x >> 27) | 128;
+ if (x >= (1 << 20))
+ *dp++ = (x >> 20) | 128;
+ *dp++ = (x >> 13) | 128;
+ }
+ if (x >= (1 << 6))
+ *dp++ = (x >> 6) | 128;
+ *dp++ = eof ? (x & 63) : (x & 63) | 64;
+ data->incoredatafree -= dp - (data->incoredata + data->incoredatalen);
+ data->incoredatalen = dp - data->incoredata;
+}
+
+static void