您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ BSWAP32函数代码示例

51自学网 2021-06-01 19:53:30
  C++
这篇教程C++ BSWAP32函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中BSWAP32函数的典型用法代码示例。如果您正苦于以下问题:C++ BSWAP32函数的具体用法?C++ BSWAP32怎么用?C++ BSWAP32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了BSWAP32函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CopyLineQwordsSwap

static void CopyLineQwordsSwap(void * dst, const void * src, u32 qwords){#ifdef FAST_TMEM_COPY	u32* src32 = (u32*)src;	u32* dst32 = (u32*)dst;	DAEDALUS_ASSERT( ((uintptr_t)src32&0x3 )==0, "src is not aligned!");	while(qwords--)	{		dst32[1]  = BSWAP32(src32[0]);		dst32[0]  = BSWAP32(src32[1]);		dst32 += 2;		src32 += 2;	}#else	u8* src8 = (u8*)src;	u8* dst8 = (u8*)dst;	u32 bytes = qwords * 8;	while(bytes--)	{		*(u8*)((uintptr_t)dst8++ ^ 0x4)  = *(u8*)((uintptr_t)src8++ ^ U8_TWIDDLE);	}#endif}
开发者ID:hulkholden,项目名称:daedalus,代码行数:25,


示例2: IsGoodGRFConfigList

/** Check if all GRFs in the GRF config from a savegame can be loaded. * @param grfconfig GrfConfig to check * @return will return any of the following 3 values:<br> * <ul> * <li> GLC_ALL_GOOD: No problems occured, all GRF files were found and loaded * <li> GLC_COMPATIBLE: For one or more GRF's no exact match was found, but a *     compatible GRF with the same grfid was found and used instead * <li> GLC_NOT_FOUND: For one or more GRF's no match was found at all * </ul> */GRFListCompatibility IsGoodGRFConfigList(GRFConfig *grfconfig){	GRFListCompatibility res = GLC_ALL_GOOD;	for (GRFConfig *c = grfconfig; c != NULL; c = c->next) {		const GRFConfig *f = FindGRFConfig(c->ident.grfid, c->ident.md5sum);		if (f == NULL) {			char buf[256];			/* If we have not found the exactly matching GRF try to find one with the			 * same grfid, as it most likely is compatible */			f = FindGRFConfig(c->ident.grfid);			if (f != NULL) {				md5sumToString(buf, lastof(buf), c->ident.md5sum);				DEBUG(grf, 1, "NewGRF %08X (%s) not found; checksum %s. Compatibility mode on", BSWAP32(c->ident.grfid), c->filename, buf);				if (!HasBit(c->flags, GCF_COMPATIBLE)) {					/* Preserve original_md5sum after it has been assigned */					SetBit(c->flags, GCF_COMPATIBLE);					memcpy(c->original_md5sum, c->ident.md5sum, sizeof(c->original_md5sum));				}				/* Non-found has precedence over compatibility load */				if (res != GLC_NOT_FOUND) res = GLC_COMPATIBLE;				goto compatible_grf;			}			/* No compatible grf was found, mark it as disabled */			md5sumToString(buf, lastof(buf), c->ident.md5sum);			DEBUG(grf, 0, "NewGRF %08X (%s) not found; checksum %s", BSWAP32(c->ident.grfid), c->filename, buf);			c->status = GCS_NOT_FOUND;			res = GLC_NOT_FOUND;		} else {compatible_grf:			DEBUG(grf, 1, "Loading GRF %08X from %s", BSWAP32(f->ident.grfid), f->filename);			/* The filename could be the filename as in the savegame. As we need			 * to load the GRF here, we need the correct filename, so overwrite that			 * in any case and set the name and info when it is not set already.			 * When the GCF_COPY flag is set, it is certain that the filename is			 * already a local one, so there is no need to replace it. */			if (!HasBit(c->flags, GCF_COPY)) {				free(c->filename);				c->filename = strdup(f->filename);				memcpy(c->ident.md5sum, f->ident.md5sum, sizeof(c->ident.md5sum));				if (c->name == NULL && f->name != NULL) c->name = strdup(f->name);				if (c->info == NULL && f->info != NULL) c->info = strdup(f->info);				c->error = NULL;			}		}	}	return res;}
开发者ID:jemmyw,项目名称:openttd,代码行数:62,


示例3: CopyLine

static inline void CopyLine(void * dst, const void * src, u32 bytes){#ifdef FAST_TMEM_COPY	u32* src32 = (u32*)src;	u32* dst32 = (u32*)dst;	DAEDALUS_ASSERT((bytes&0x3)==0, "CopyLine: Remaning bytes! (%d)",bytes);	u32 size32 = bytes >> 2;	u32 src_alignment = (uintptr_t)src32&0x3;	if(src_alignment == 0)	{		while (size32--)		{			*dst32++ = BSWAP32(src32[0]);			src32++;		}	}	else	{		// Zelda and DK64 have unaligned copies. so let's optimize 'em		src32 = (u32*)((uintptr_t)src & ~0x3);		u32 src_tmp = *src32++;		u32 dst_tmp = 0;		// calculate offset 3..1..2		u32 offset = 4-src_alignment;		u32 lshift = src_alignment<<3;		u32 rshift = offset<<3;		while(size32--)		{			dst_tmp = src_tmp << lshift;			src_tmp = *src32++;			dst_tmp|= src_tmp >> rshift;			*dst32++ = BSWAP32(dst_tmp);		}		src32 -= offset;	}#else	u8* src8 = (u8*)src;	u8* dst8 = (u8*)dst;	while(bytes--)	{		*dst8++ = *(u8*)((uintptr_t)src8++ ^ U8_TWIDDLE);	}#endif}
开发者ID:hulkholden,项目名称:daedalus,代码行数:49,


示例4: memnew

void EditorExportPlatformOSX::_make_icon(const Image& p_icon,Vector<uint8_t>& icon) {	Ref<ImageTexture> it = memnew( ImageTexture );	int size=512;	Vector<uint8_t> data;	data.resize(8);	data[0]='i';	data[1]='c';	data[2]='n';	data[3]='s';	const char *name[]={"ic09","ic08","ic07","icp6","icp5","icp4"};	int index=0;	while(size>=16) {		Image copy = p_icon;		copy.convert(Image::FORMAT_RGBA);		copy.resize(size,size);		it->create_from_image(copy);		String path = EditorSettings::get_singleton()->get_settings_path()+"/tmp/icon.png";		ResourceSaver::save(path,it);		FileAccess *f = FileAccess::open(path,FileAccess::READ);		ERR_FAIL_COND(!f);		int ofs = data.size();		uint32_t len = f->get_len();		data.resize(data.size()+len+8);		f->get_buffer(&data[ofs+8],len);		memdelete(f);		len+=8;		len=BSWAP32(len);		copymem(&data[ofs],name[index],4);		encode_uint32(len,&data[ofs+4]);		index++;		size/=2;	}	uint32_t total_len = data.size();	total_len = BSWAP32(total_len);	encode_uint32(total_len,&data[4]);	icon=data;}
开发者ID:9cat,项目名称:godot,代码行数:48,


示例5: global_user_list_cb

static voidglobal_user_list_cb (USER * user, struct guldata *data){    ASSERT (validate_user (user));    ASSERT (data != 0);    if (data->flags)    {	/* selectively display users based on user level/muzzle/cloak */	if (!	    (((data->flags & ON_GFLAG_ADMIN) && user->level == LEVEL_ADMIN)	     || ((data->flags & ON_GFLAG_ELITE) && user->level == LEVEL_ELITE)	     || ((data->flags & ON_GFLAG_MODERATOR)		 && user->level == LEVEL_MODERATOR)	     || ((data->flags & ON_GFLAG_USERS) && user->level == LEVEL_USER)	     || ((data->flags & ON_GFLAG_LEECH) && user->level == LEVEL_LEECH)	     || ((data->flags & ON_GFLAG_MUZZLED) && user->muzzled)	     || ((data->flags & ON_GFLAG_CLOAKED) && user->cloaked)	     || ((data->flags & ON_GFLAG_USERIP) && (user->ip & data->mask) == (data->ip & data->mask))))	    return;    }    if (data->server && *data->server != '*' &&	strcasecmp (data->server, user->server) != 0)	return;			/* no match */    send_cmd (data->con, MSG_SERVER_GLOBAL_USER_LIST, "%s %s", user->nick,	      my_ntoa (BSWAP32 (user->ip)));}
开发者ID:OS2World,项目名称:APP-SERVER-opennap,代码行数:26,


示例6: BSWAP32

int DumpScan::process(DumpDataList::iterator startDump, unsigned long startByte){	unsigned long min = m_address - m_maxOffset;	unsigned long max = m_address;	if (m_maxOffset > m_address)		min = 0;	m_counter = 0;	for (DumpDataList::iterator it = startDump; it!= m_dumps.end(); ++it)	{		char *data = (*it)->data;		CHECK_CANCEL;		for (unsigned long i=startByte; i<((*it)->header.end - (*it)->header.begin)-3; ++i)		{			unsigned long currentAddress = BSWAP32(*(unsigned long*)(&data[i]));			CHECK_CANCEL;			if ( currentAddress >= min && currentAddress <= max) //we want this			{				PointerOffsets po = m_offsets;				po.push_front(m_address - currentAddress);				m_results.push_back(ScanResult(i+(*it)->header.begin, po));				if (++m_counter >= m_maxResults)				{					m_counter = 0;					m_currentDump = it;					m_currentByte = i+1;					return DUMP_SCAN_STATUS_CONTINUE;				}			}		}	}	return DUMP_SCAN_STATUS_DONE;}
开发者ID:Encapsulate,项目名称:CCCheat,代码行数:32,


示例7: cmd_page_erase

void cmd_page_erase(){	int adrs=BSWAP32(PacketFromPC.adrs);	if( check_flash_adrs(adrs)) {		FLASH_ErasePage(adrs);	}}
开发者ID:iruka-,项目名称:ARM_BOOTLOADER,代码行数:7,


示例8: cmd_page_write

/******************************************************************** *	FLASHのペ
C++ BSWAP_64函数代码示例
C++ BSTR函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。