⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 optdebug.c

📁 windows gzip source code
💻 C
字号:
/*
 * optdebug.c
 *
 * Optimal encoder debugging stubs
 */
#include <string.h>
#include <stdio.h>
#include <crtdbg.h>
#include "deflate.h"


#ifdef _DEBUG
static void OptimalEncoderVerifyTreeStructure(t_encoder_context *context, byte val1, byte val2, long where)
{
	long left, right;

	if (where == 0)
		return;

	_ASSERT(context->optimal_encoder->window[where] == val1);
	_ASSERT(context->optimal_encoder->window[where+1] == val2);

	left = context->optimal_encoder->search_left[where];
	right = context->optimal_encoder->search_right[where];

	OptimalEncoderVerifyTreeStructure(context, val1, val2, left);
	OptimalEncoderVerifyTreeStructure(context, val1, val2, right);
}


void OptimalEncoderVerifyHashes(t_encoder_context *context, long bufpos)
{
	long i;

	for (i = 0; i < NUM_DIRECT_LOOKUP_TABLE_ELEMENTS; i++)
	{
		long	where = context->optimal_encoder->search_tree_root[i];
		USHORT	tree_to_use;

		if (where == 0)
			continue;

		tree_to_use = *((USHORT UNALIGNED *) &context->optimal_encoder->window[where]);

		_ASSERT(where < bufpos);
		_ASSERT(tree_to_use == i);

		OptimalEncoderVerifyTreeStructure(context, context->optimal_encoder->window[where], context->optimal_encoder->window[where+1], where);
	}
}
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -