mirror of
				https://github.com/eledio-devices/thirdparty-miniz.git
				synced 2025-10-31 08:42:39 +01:00 
			
		
		
		
	If anyone wants to have a minified version of if a script could be written to do this automatically.
		
			
				
	
	
		
			70 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #pragma once
 | |
| #include <stdlib.h>
 | |
| #include <string.h>
 | |
| #include <assert.h>
 | |
| 
 | |
| 
 | |
| // ------------------- Types and macros
 | |
| typedef unsigned char mz_uint8;
 | |
| typedef signed short mz_int16;
 | |
| typedef unsigned short mz_uint16;
 | |
| typedef unsigned int mz_uint32;
 | |
| typedef unsigned int mz_uint;
 | |
| typedef long long mz_int64;
 | |
| typedef unsigned long long mz_uint64;
 | |
| typedef int mz_bool;
 | |
| 
 | |
| #define MZ_FALSE (0)
 | |
| #define MZ_TRUE (1)
 | |
| 
 | |
| // An attempt to work around MSVC's spammy "warning C4127: conditional expression is constant" message.
 | |
| #ifdef _MSC_VER
 | |
|    #define MZ_MACRO_END while (0, 0)
 | |
| #else
 | |
|    #define MZ_MACRO_END while (0)
 | |
| #endif
 | |
| 
 | |
| #define MZ_ASSERT(x) assert(x)
 | |
| 
 | |
| #ifdef MINIZ_NO_MALLOC
 | |
|   #define MZ_MALLOC(x) NULL
 | |
|   #define MZ_FREE(x) (void)x, ((void)0)
 | |
|   #define MZ_REALLOC(p, x) NULL
 | |
| #else
 | |
|   #define MZ_MALLOC(x) malloc(x)
 | |
|   #define MZ_FREE(x) free(x)
 | |
|   #define MZ_REALLOC(p, x) realloc(p, x)
 | |
| #endif
 | |
| 
 | |
| #define MZ_MAX(a,b) (((a)>(b))?(a):(b))
 | |
| #define MZ_MIN(a,b) (((a)<(b))?(a):(b))
 | |
| #define MZ_CLEAR_OBJ(obj) memset(&(obj), 0, sizeof(obj))
 | |
| 
 | |
| #if MINIZ_USE_UNALIGNED_LOADS_AND_STORES && MINIZ_LITTLE_ENDIAN
 | |
|   #define MZ_READ_LE16(p) *((const mz_uint16 *)(p))
 | |
|   #define MZ_READ_LE32(p) *((const mz_uint32 *)(p))
 | |
| #else
 | |
|   #define MZ_READ_LE16(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U))
 | |
|   #define MZ_READ_LE32(p) ((mz_uint32)(((const mz_uint8 *)(p))[0]) | ((mz_uint32)(((const mz_uint8 *)(p))[1]) << 8U) | ((mz_uint32)(((const mz_uint8 *)(p))[2]) << 16U) | ((mz_uint32)(((const mz_uint8 *)(p))[3]) << 24U))
 | |
| #endif
 | |
| 
 | |
| #ifdef _MSC_VER
 | |
|   #define MZ_FORCEINLINE __forceinline
 | |
| #elif defined(__GNUC__)
 | |
|   #define MZ_FORCEINLINE inline __attribute__((__always_inline__))
 | |
| #else
 | |
|   #define MZ_FORCEINLINE inline
 | |
| #endif
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| extern "C" {
 | |
| #endif
 | |
| 
 | |
| extern void *miniz_def_alloc_func(void *opaque, size_t items, size_t size);
 | |
| extern void miniz_def_free_func(void *opaque, void *address);
 | |
| extern void *miniz_def_realloc_func(void *opaque, void *address, size_t items, size_t size);
 | |
| 
 | |
| #ifdef __cplusplus
 | |
| }
 | |
| #endif
 |