aboutsummaryrefslogtreecommitdiffstats
path: root/varint.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-10-08 12:17:55 -0700
committerJunio C Hamano <gitster@pobox.com>2025-10-08 12:17:55 -0700
commit75f8dfabaa2f071ac2b527d225b0312d70f94e64 (patch)
tree0df6ed8cb28ecc9bf34c423f0d3aa87b791db8fb /varint.c
parentMerge branch 'mh/doc-credential-url-prefix' (diff)
parentci: enable Rust for breaking-changes jobs (diff)
downloadgit-75f8dfabaa2f071ac2b527d225b0312d70f94e64.tar.gz
git-75f8dfabaa2f071ac2b527d225b0312d70f94e64.zip
Merge branch 'ps/rust-balloon'
Dip our toes a bit to (optionally) use Rust implemented helper called from our C code. * ps/rust-balloon: ci: enable Rust for breaking-changes jobs ci: convert "pedantic" job into full build with breaking changes BreakingChanges: announce Rust becoming mandatory varint: reimplement as test balloon for Rust varint: use explicit width for integers help: report on whether or not Rust is enabled Makefile: introduce infrastructure to build internal Rust library Makefile: reorder sources after includes meson: add infrastructure to build internal Rust library
Diffstat (limited to 'varint.c')
-rw-r--r--varint.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/varint.c b/varint.c
index 409c4977a1..03cd54416b 100644
--- a/varint.c
+++ b/varint.c
@@ -1,11 +1,11 @@
#include "git-compat-util.h"
#include "varint.h"
-uintmax_t decode_varint(const unsigned char **bufp)
+uint64_t decode_varint(const unsigned char **bufp)
{
const unsigned char *buf = *bufp;
unsigned char c = *buf++;
- uintmax_t val = c & 127;
+ uint64_t val = c & 127;
while (c & 128) {
val += 1;
if (!val || MSB(val, 7))
@@ -17,7 +17,7 @@ uintmax_t decode_varint(const unsigned char **bufp)
return val;
}
-int encode_varint(uintmax_t value, unsigned char *buf)
+uint8_t encode_varint(uint64_t value, unsigned char *buf)
{
unsigned char varint[16];
unsigned pos = sizeof(varint) - 1;