Restored cast for C++ (fse)

This commit is contained in:
Yann Collet
2015-01-29 07:13:54 +01:00
parent 6434adcf54
commit 1cc58def2d
+10 -10
View File
@@ -132,7 +132,7 @@ static U32 FSE_readLE32(const void* memPtr)
return FSE_read32(memPtr); return FSE_read32(memPtr);
else 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)); 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 else
{ {
BYTE* p = memPtr; BYTE* p = (BYTE*)memPtr;
p[0] = (BYTE)val32; p[0] = (BYTE)val32;
p[1] = (BYTE)(val32>>8); p[1] = (BYTE)(val32>>8);
p[2] = (BYTE)(val32>>16); p[2] = (BYTE)(val32>>16);
@@ -166,7 +166,7 @@ static U64 FSE_readLE64(const void* memPtr)
return FSE_read64(memPtr); return FSE_read64(memPtr);
else 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) 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)); + ((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 else
{ {
BYTE* p = memPtr; BYTE* p = (BYTE*)memPtr;
p[0] = (BYTE)val64; p[0] = (BYTE)val64;
p[1] = (BYTE)(val64>>8); p[1] = (BYTE)(val64>>8);
p[2] = (BYTE)(val64>>16); p[2] = (BYTE)(val64>>16);
@@ -554,8 +554,8 @@ typedef struct
int FSE_compareRankT(const void* r1, const void* r2) int FSE_compareRankT(const void* r1, const void* r2)
{ {
const rank_t* R1 = r1; const rank_t* R1 = (const rank_t*)r1;
const rank_t* R2 = r2; const rank_t* R2 = (const rank_t*)r2;
return 2 * (R1->count < R2->count) - 1; 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) 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); FSE_decode_t* const cell = (FSE_decode_t*)(base32 + 1);
/* Sanity check */ /* Sanity check */
@@ -1008,7 +1008,7 @@ size_t FSE_buildDTable_rle (void* DTable, BYTE symbolValue)
size_t FSE_buildDTable_raw (void* DTable, unsigned nbBits) 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); FSE_decode_t* dinfo = (FSE_decode_t*)(base32 + 1);
const unsigned tableSize = 1 << nbBits; const unsigned tableSize = 1 << nbBits;
const unsigned tableMask = tableSize - 1; 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) 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]); DStatePtr->state = FSE_readBits(bitD, base32[0]);
FSE_reloadDStream(bitD); FSE_reloadDStream(bitD);
DStatePtr->table = base32 + 1; 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) size_t FSE_FUNCTION_NAME(FSE_buildDTable, FSE_FUNCTION_EXTENSION)
(void* DTable, const short* const normalizedCounter, unsigned maxSymbolValue, unsigned tableLog) (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); FSE_DECODE_TYPE* const tableDecode = (FSE_DECODE_TYPE*) (base32+1);
const U32 tableSize = 1 << tableLog; const U32 tableSize = 1 << tableLog;
const U32 tableMask = tableSize-1; const U32 tableMask = tableSize-1;