On Sun, Jan 03, 2021 at 11:57:32PM +0200, Kari Argillander wrote: > > + /* > > + * mirror of len, but signed, because run_packed_size() > > + * works with signed int only > > + */ > > + len64 = len; > > + > > + /* how much bytes is packed len64 */ > > + size_size = run_packed_size(&len64); > > Does (s64 *)&len work just fine? No. run_packed_size() is going to load/store eight bytes to/from that pointer. You can't just cast a pointer to a different size and expect it to work (it might happen to work, particularly on little-endian, but big-endian is going to get completely the wrong value).