Re: Expressing large integer values in D-Bus APIs
Thiago Macieira <[email protected]>
| Newsgroups | gmane.comp.freedesktop.dbus |
|---|---|
| Message-ID | <5194390.12ut8onCOo@tjmaciei-mobl1> |
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 > <http://www.codecodex.com/wiki/Variable-Length_Integers> 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 not. 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) macieira.info - thiago (AT) kde.org Software Architect - Intel Open Source Technology Center _______________________________________________ dbus mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dbus