The vuint/vint encoding is quite slow, possibly due to the use
of BytesIO and byte-wise writing, for what's really almost always
a fixed-size buffer since we typically don't deal with values
that don't fit into a 64-bit signed integer.
Implement this in C to make it faster, at least for those that
fit into signed 64-bit integers (long long, because python makes
overflow checking for unsigned 64-bit integers hard), and if the
C version throws an OverflowError, fall back to the python code.
Also add a test for something that doesn't actually fit into a
64-bit integer.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: adjusted bup_vuint_encode and bup_vint_encode
to just directly return the PyBytes_FromStringAndSize result] Signed-off-by: Rob Browning <rlb@defaultvalue.org> Tested-by: Rob Browning <rlb@defaultvalue.org>