mirror of
				https://github.com/facebook/zstd.git
				synced 2025-10-31 08:37:43 +02:00 
			
		
		
		
	reduce the amount of includes in "cover.h"
This commit is contained in:
		| @@ -25,7 +25,7 @@ | ||||
| #include "../common/error_private.h" | ||||
| #define ZSTD_DEPS_NEED_MALLOC | ||||
| #define ZSTD_DEPS_NEED_MATH64 | ||||
| #include "../common/zstd_deps.h"  /* ZSTD_malloc, ZSTD_free, ZSTD_memcpy, ZSTD_memset */ | ||||
| #include "../common/zstd_deps.h"  /* ZSTD_memset */ | ||||
| #include "../common/bits.h" /* ZSTD_highbit32 */ | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -31,8 +31,8 @@ | ||||
| #endif | ||||
|  | ||||
| #include "../common/mem.h" /* read */ | ||||
| #include "../common/pool.h" | ||||
| #include "../common/threading.h" | ||||
| #include "../common/pool.h" /* POOL_ctx */ | ||||
| #include "../common/threading.h" /* ZSTD_pthread_mutex_t */ | ||||
| #include "../common/zstd_internal.h" /* includes zstd.h */ | ||||
| #include "../common/bits.h" /* ZSTD_highbit32 */ | ||||
| #include "../zdict.h" | ||||
| @@ -78,7 +78,7 @@ static clock_t g_time = 0; | ||||
| #undef  LOCALDISPLAYUPDATE | ||||
| #define LOCALDISPLAYUPDATE(displayLevel, l, ...)                               \ | ||||
|   if (displayLevel >= l) {                                                     \ | ||||
|     if ((clock() - g_time > g_refreshRate) || (displayLevel >= 4)) {             \ | ||||
|     if ((clock() - g_time > g_refreshRate) || (displayLevel >= 4)) {           \ | ||||
|       g_time = clock();                                                        \ | ||||
|       DISPLAY(__VA_ARGS__);                                                    \ | ||||
|     }                                                                          \ | ||||
| @@ -301,9 +301,10 @@ static int WIN_CDECL COVER_strict_cmp8(const void *lp, const void *rp) { | ||||
|  * Returns the first pointer in [first, last) whose element does not compare | ||||
|  * less than value.  If no such element exists it returns last. | ||||
|  */ | ||||
| static const size_t *COVER_lower_bound(const size_t *first, const size_t *last, | ||||
| static const size_t *COVER_lower_bound(const size_t* first, const size_t* last, | ||||
|                                        size_t value) { | ||||
|   size_t count = last - first; | ||||
|   size_t count = (size_t)(last - first); | ||||
|   assert(last >= first); | ||||
|   while (count != 0) { | ||||
|     size_t step = count / 2; | ||||
|     const size_t *ptr = first; | ||||
| @@ -549,7 +550,8 @@ static void COVER_ctx_destroy(COVER_ctx_t *ctx) { | ||||
|  */ | ||||
| static size_t COVER_ctx_init(COVER_ctx_t *ctx, const void *samplesBuffer, | ||||
|                           const size_t *samplesSizes, unsigned nbSamples, | ||||
|                           unsigned d, double splitPoint) { | ||||
|                           unsigned d, double splitPoint) | ||||
| { | ||||
|   const BYTE *const samples = (const BYTE *)samplesBuffer; | ||||
|   const size_t totalSamplesSize = COVER_sum(samplesSizes, nbSamples); | ||||
|   /* Split samples into testing and training sets */ | ||||
| @@ -907,8 +909,10 @@ void COVER_best_start(COVER_best_t *best) { | ||||
|  * Decrements liveJobs and signals any waiting threads if liveJobs == 0. | ||||
|  * If this dictionary is the best so far save it and its parameters. | ||||
|  */ | ||||
| void COVER_best_finish(COVER_best_t *best, ZDICT_cover_params_t parameters, | ||||
|                               COVER_dictSelection_t selection) { | ||||
| void COVER_best_finish(COVER_best_t* best, | ||||
|                       ZDICT_cover_params_t parameters, | ||||
|                       COVER_dictSelection_t selection) | ||||
| { | ||||
|   void* dict = selection.dictContent; | ||||
|   size_t compressedSize = selection.totalCompressedSize; | ||||
|   size_t dictSize = selection.dictSize; | ||||
| @@ -980,8 +984,8 @@ COVER_dictSelection_t COVER_selectDict(BYTE* customDictContent, size_t dictBuffe | ||||
|   size_t largestCompressed = 0; | ||||
|   BYTE* customDictContentEnd = customDictContent + dictContentSize; | ||||
|  | ||||
|   BYTE * largestDictbuffer = (BYTE *)malloc(dictBufferCapacity); | ||||
|   BYTE * candidateDictBuffer = (BYTE *)malloc(dictBufferCapacity); | ||||
|   BYTE* largestDictbuffer = (BYTE*)malloc(dictBufferCapacity); | ||||
|   BYTE* candidateDictBuffer = (BYTE*)malloc(dictBufferCapacity); | ||||
|   double regressionTolerance = ((double)params.shrinkDictMaxRegression / 100.0) + 1.00; | ||||
|  | ||||
|   if (!largestDictbuffer || !candidateDictBuffer) { | ||||
|   | ||||
| @@ -12,14 +12,8 @@ | ||||
| #  define ZDICT_STATIC_LINKING_ONLY | ||||
| #endif | ||||
|  | ||||
| #include <stdio.h>  /* fprintf */ | ||||
| #include <stdlib.h> /* malloc, free, qsort */ | ||||
| #include <string.h> /* memset */ | ||||
| #include <time.h>   /* clock */ | ||||
| #include "../common/mem.h" /* read */ | ||||
| #include "../common/pool.h" | ||||
| #include "../common/threading.h" | ||||
| #include "../common/zstd_internal.h" /* includes zstd.h */ | ||||
| #include "../common/threading.h" /* ZSTD_pthread_mutex_t */ | ||||
| #include "../common/mem.h"   /* U32, BYTE */ | ||||
| #include "../zdict.h" | ||||
|  | ||||
| /** | ||||
|   | ||||
		Reference in New Issue
	
	Block a user