Saveload: Add gamma functions to header

This commit is contained in:
Jonathan G Rennison 2024-07-16 21:57:05 +01:00
parent 3c53e9a920
commit 5aa1c2ee04
2 changed files with 7 additions and 3 deletions

View File

@ -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));
}

View File

@ -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