Expressing large integer values in D-Bus APIs

Thiago Macieira thiago at
Tue Jul 18 00:18:25 UTC 2017

On segunda-feira, 17 de julho de 2017 16:20:06 PDT Lawrence D'Oliveiro wrote:
> On Mon, 17 Jul 2017 15:34:08 -0700, Thiago Macieira wrote:
> > I'd recommend you just follow regular "bigint" type marshalling in
> > other binary protocols.
> Several years ago I came up with a variation
> <> on the scheme
> used in Standard MIDI files. By applying an offset adjustment at each
> stage in the shift, I create a fully bijective encoding, while making
> the packing scheme ever so slightly more efficient.

Actually, it isn't. Note that the array's length is present in D-Bus whether 
you want it or not, so we don't need the high bit to indicate continuation or 

For example, to encode a value like 40000, your mechanism would write:
  c0 b8 01

whereas the suggestion I made would write:
  40 9c

Thiago Macieira - thiago (AT) - thiago (AT)
   Software Architect - Intel Open Source Technology Center

More information about the dbus mailing list