aboutsummaryrefslogtreecommitdiffstats
path: root/varint.c
AgeCommit message (Collapse)AuthorFilesLines
2025-10-02varint: use explicit width for integersPatrick Steinhardt1-3/+3
The varint subsystem currently uses implicit widths for integers. On the one hand we use `uintmax_t` for the actual value. On the other hand, we use `int` for the length of the encoded varint. Both of these have known maximum values, as we only support at most 16 bytes when encoding varints. Thus, we know that we won't ever exceed `uint64_t` for the actual value and `uint8_t` for the prefix length. Refactor the code to use explicit widths. Besides making the logic platform-independent, it also makes our life a bit easier in the next commit, where we reimplement "varint.c" in Rust. Suggested-by: Ezekiel Newren <ezekielnewren@gmail.com> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-09-15cleanups: ensure that git-compat-util.h is included firstDavid Aguilar1-0/+1
CodingGuidelines states that the first #include in C files should be git-compat-util.h or another header file that includes it, such as cache.h or builtin.h. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-03varint: make it available outside the context of packJunio C Hamano1-0/+29
Signed-off-by: Junio C Hamano <gitster@pobox.com>