From 5aa1c2ee04387701ecd11d7efe7e2efdde331aa6 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 16 Jul 2024 21:57:05 +0100 Subject: [PATCH] Saveload: Add gamma functions to header --- src/sl/saveload.cpp | 6 +++--- src/sl/saveload.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/sl/saveload.cpp b/src/sl/saveload.cpp index 15d3fecdd5..be2e445f94 100644 --- a/src/sl/saveload.cpp +++ b/src/sl/saveload.cpp @@ -685,7 +685,7 @@ size_t SlGetBytesWritten() * x = ((x & 0x7F) << 8) + SlReadByte(); * @return Return the value of the index */ -static uint SlReadSimpleGamma() +uint SlReadSimpleGamma() { uint i = SlReadByte(); if (HasBit(i, 7)) { @@ -727,7 +727,7 @@ static uint SlReadSimpleGamma() * @param i Index being written */ -static void SlWriteSimpleGamma(size_t i) +void SlWriteSimpleGamma(size_t i) { if (i >= (1 << 7)) { if (i >= (1 << 14)) { @@ -752,7 +752,7 @@ static void SlWriteSimpleGamma(size_t i) } /** Return how many bytes used to encode a gamma value */ -static inline uint SlGetGammaLength(size_t i) +uint SlGetGammaLength(size_t i) { return 1 + (i >= (1 << 7)) + (i >= (1 << 14)) + (i >= (1 << 21)) + (i >= (1 << 28)); } diff --git a/src/sl/saveload.h b/src/sl/saveload.h index 2106aff551..2e55cb1477 100644 --- a/src/sl/saveload.h +++ b/src/sl/saveload.h @@ -984,6 +984,10 @@ void SlSetLength(size_t length); size_t SlCalcObjMemberLength(const void *object, const SaveLoad &sld); size_t SlCalcObjLength(const void *object, const SaveLoadTable &slt); +uint SlReadSimpleGamma(); +void SlWriteSimpleGamma(size_t i); +uint SlGetGammaLength(size_t i); + /** * Run proc, automatically prepending the written length * @param proc The callback procedure that is called