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

📄 utilities.h

📁 这是VCF框架的代码
💻 H
字号:
// ==========================================================// Utility functions//// Design and implementation by// - Floris van den Berg (flvdberg@wxs.nl)//// This file is part of FreeImage 2//// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER// THIS DISCLAIMER.//// Use at your own risk!// ==========================================================#ifndef UTILITIES_H#define UTILITIES_H#ifndef _INC_MATH#include <math.h>#endif#ifndef _INC_STDLIB#include <stdlib.h> #endif#ifndef _INC_MEMORY#include <memory.h>#endif#ifndef _INC_STDIO#include <stdio.h>#endif// ==========================================================//   Utility functions// ==========================================================inline intround(double x) {	return (int)floor(x + 0.5);}inline unsigned charHINIBBLE (unsigned char byte) {	return byte & 240;}inline unsigned charLOWNIBBLE (unsigned char byte) {	return byte & 15;}inline intCalculateUsedBits(int bits) {	int bit_count = 0;	unsigned bit = 1;	for (unsigned i = 0; i < 32; i++) {		if ((bits & bit) == bit) {			bit_count++;		}		bit <<= 1;	}	return bit_count;}inline intCalculateLine(int width, int bitdepth) {	return ((width * bitdepth) + 7) / 8;}inline intCalculatePitch(int line) {	return line + 3 & ~3;}inline intCalculateUsedColors(int bitcount) {	int c = 1 << bitcount;	return ((c <= 256) && (c > 1)) ? c : 0;}inline unsigned char *CalculateScanLine(unsigned char *bits, unsigned pitch, int scanline) {	return (bits + (pitch * scanline));}#endif

⌨️ 快捷键说明

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