Move retro_le to archive_file_zlib.c

This commit is contained in:
twinaphex 2017-06-28 04:20:52 +02:00
parent ba71dda1b2
commit 50b07ad8c4
2 changed files with 14 additions and 13 deletions

View File

@ -21,11 +21,12 @@
*/
#include <stdlib.h>
#include <string.h>
#include <file/archive_file.h>
#include <streams/file_stream.h>
#include <streams/trans_stream.h>
#include <string.h>
#include <retro_inline.h>
#include <retro_miscellaneous.h>
#include <encodings/crc32.h>
@ -40,6 +41,18 @@
#define END_OF_CENTRAL_DIR_SIGNATURE 0x06054b50
#endif
static INLINE uint32_t read_le(const uint8_t *data, unsigned size)
{
unsigned i;
uint32_t val = 0;
size *= 8;
for (i = 0; i < size; i += 8)
val |= (uint32_t)*data++ << i;
return val;
}
static void *zlib_stream_new(void)
{
return zlib_inflate_backend.stream_new();

View File

@ -169,18 +169,6 @@ static INLINE uint32_t prev_pow2(uint32_t v)
return v - (v >> 1);
}
static INLINE uint32_t read_le(const uint8_t *data, unsigned size)
{
unsigned i;
uint32_t val = 0;
size *= 8;
for (i = 0; i < size; i += 8)
val |= (uint32_t)*data++ << i;
return val;
}
/* Helper macros and struct to keep track of many booleans.
* To check for multiple bits, use &&, not &.
* For OR, | can be used. */