From 1cc58def2df7253b1da82675d3c6f26af99f11d7 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 29 Jan 2015 07:13:54 +0100 Subject: [PATCH] Restored cast for C++ (fse) --- lib/fse.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/fse.c b/lib/fse.c index cc9097c8..a1aeea52 100644 --- a/lib/fse.c +++ b/lib/fse.c @@ -132,7 +132,7 @@ static U32 FSE_readLE32(const void* memPtr) return FSE_read32(memPtr); else { - const BYTE* p = memPtr; + const BYTE* p = (const BYTE*)memPtr; return (U32)((U32)p[0] + ((U32)p[1]<<8) + ((U32)p[2]<<16) + ((U32)p[3]<<24)); } } @@ -145,7 +145,7 @@ static void FSE_writeLE32(void* memPtr, U32 val32) } else { - BYTE* p = memPtr; + BYTE* p = (BYTE*)memPtr; p[0] = (BYTE)val32; p[1] = (BYTE)(val32>>8); p[2] = (BYTE)(val32>>16); @@ -166,7 +166,7 @@ static U64 FSE_readLE64(const void* memPtr) return FSE_read64(memPtr); else { - const BYTE* p = memPtr; + const BYTE* p = (const BYTE*)memPtr; return (U64)((U64)p[0] + ((U64)p[1]<<8) + ((U64)p[2]<<16) + ((U64)p[3]<<24) + ((U64)p[4]<<32) + ((U64)p[5]<<40) + ((U64)p[6]<<48) + ((U64)p[7]<<56)); } @@ -180,7 +180,7 @@ static void FSE_writeLE64(void* memPtr, U64 val64) } else { - BYTE* p = memPtr; + BYTE* p = (BYTE*)memPtr; p[0] = (BYTE)val64; p[1] = (BYTE)(val64>>8); p[2] = (BYTE)(val64>>16); @@ -554,8 +554,8 @@ typedef struct int FSE_compareRankT(const void* r1, const void* r2) { - const rank_t* R1 = r1; - const rank_t* R2 = r2; + const rank_t* R1 = (const rank_t*)r1; + const rank_t* R2 = (const rank_t*)r2; return 2 * (R1->count < R2->count) - 1; } @@ -990,7 +990,7 @@ size_t FSE_decompressRLE(void* dst, size_t originalSize, size_t FSE_buildDTable_rle (void* DTable, BYTE symbolValue) { - U32* const base32 = DTable; + U32* const base32 = (U32*)DTable; FSE_decode_t* const cell = (FSE_decode_t*)(base32 + 1); /* Sanity check */ @@ -1008,7 +1008,7 @@ size_t FSE_buildDTable_rle (void* DTable, BYTE symbolValue) size_t FSE_buildDTable_raw (void* DTable, unsigned nbBits) { - U32* const base32 = DTable; + U32* const base32 = (U32*)DTable; FSE_decode_t* dinfo = (FSE_decode_t*)(base32 + 1); const unsigned tableSize = 1 << nbBits; const unsigned tableMask = tableSize - 1; @@ -1127,7 +1127,7 @@ unsigned FSE_reloadDStream(FSE_DStream_t* bitD) void FSE_initDState(FSE_DState_t* DStatePtr, FSE_DStream_t* bitD, const void* DTable) { - const U32* const base32 = DTable; + const U32* const base32 = (const U32*)DTable; DStatePtr->state = FSE_readBits(bitD, base32[0]); FSE_reloadDStream(bitD); DStatePtr->table = base32 + 1; @@ -1496,7 +1496,7 @@ void FSE_FUNCTION_NAME(FSE_freeDTable, FSE_FUNCTION_EXTENSION) (void* DTable) size_t FSE_FUNCTION_NAME(FSE_buildDTable, FSE_FUNCTION_EXTENSION) (void* DTable, const short* const normalizedCounter, unsigned maxSymbolValue, unsigned tableLog) { - U32* const base32 = DTable; + U32* const base32 = (U32*)DTable; FSE_DECODE_TYPE* const tableDecode = (FSE_DECODE_TYPE*) (base32+1); const U32 tableSize = 1 << tableLog; const U32 tableMask = tableSize-1;