On Tue May 21, 2024 at 8:36 AM EEST, Bharat Bhushan wrote: > > - data_len -= 2; > > + (*data++) = _tag(UNIV, PRIM, INT); > > Just for my clarification: > First index of "data" is updated here with tag and data pointer incremented. > Next comment for continuation > > > + data_len--; > > > > - data[0] = _tag(UNIV, PRIM, INT); > > - if (integer == 0) { > > - *d++ = 0; > > - goto out; > > + if (!memchr_inv(integer, 0, integer_len)) { > > + data[1] = 1; > > + data[2] = 0; > > + return &data[2]; > > Here we are effectively setting second and third index of original > "data" pointer as "data" pointer was incremented earlier. > So second index of original "data" pointer is not touched. Also > returning 3rd index pointer of original data pointer > > Is that intentional? No! I read the diff few times, and I think you have a point. Indices should be 0 (length) and 1 (value). I.e. it forms an encoded version of zero. The last index what it should be, i.e. return address of the next byte after the encoded integer. Thanks for pointing this out. > Thanks > -Bharat BR, Jarkko