当前位置: 首页>>代码示例>>C++>>正文


C++ bswap_32函数代码示例

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


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

示例1: __glXPointParameterfvReqSize

int
__glXPointParameterfvReqSize( const GLbyte * pc, Bool swap )
{
GLenum pname       = * (GLenum *)(pc + 0);
    GLsizei compsize;

    if (swap) {
        pname = bswap_32(pname);
    }

    compsize = __glPointParameterfv_size(pname);
    return __GLX_PAD((compsize * 4));
}
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:13,代码来源:indirect_reqsize.c

示例2: __glXConvolutionParameterfvReqSize

int
__glXConvolutionParameterfvReqSize( const GLbyte * pc, Bool swap, int reqlen )
{
GLenum pname       = * (GLenum *)(pc + 4);
    GLsizei compsize;

    if (swap) {
        pname = bswap_32(pname);
    }

    compsize = __glConvolutionParameterfv_size(pname);
    return safe_pad(safe_mul(compsize , 4));
}
开发者ID:theqvd,项目名称:vcxsrv,代码行数:13,代码来源:indirect_reqsize.c

示例3: __glXTexGenfvReqSize

int
__glXTexGenfvReqSize( const GLbyte * pc, Bool swap )
{
GLenum pname       = * (GLenum *)(pc + 4);
    GLsizei compsize;

    if (swap) {
        pname = bswap_32(pname);
    }

    compsize = __glTexGenfv_size(pname);
    return __GLX_PAD((compsize * 4));
}
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:13,代码来源:indirect_reqsize.c

示例4: __glXFogfvReqSize

int
__glXFogfvReqSize( const GLbyte * pc, Bool swap, int reqlen )
{
GLenum pname       = * (GLenum *)(pc + 0);
    GLsizei compsize;

    if (swap) {
        pname = bswap_32(pname);
    }

    compsize = __glFogfv_size(pname);
    return safe_pad(safe_mul(compsize , 4));
}
开发者ID:theqvd,项目名称:vcxsrv,代码行数:13,代码来源:indirect_reqsize.c

示例5: mp_get_chroma_shift

int mp_get_chroma_shift(int format, int *x_shift, int *y_shift, int *component_bits)
{
    int xs = 0, ys = 0;
    int bpp;
    int err = 0;
    int bits = 8;
    if ((format & 0xff0000f0) == 0x34000050)
        format = bswap_32(format);
    if ((format & 0xf00000ff) == 0x50000034) {
        switch (format >> 24) {
        case 0x50:
            break;
        case 0x51:
            bits = 16;
            break;
        case 0x52:
            bits = 10;
            break;
        case 0x53:
            bits = 9;
            break;
        default:
            err = 1;
            break;
        }
        switch (format & 0x00ffffff) {
        case 0x00343434: // 444
            xs = 0;
            ys = 0;
            break;
        case 0x00323234: // 422
            xs = 1;
            ys = 0;
            break;
        case 0x00303234: // 420
            xs = 1;
            ys = 1;
            break;
        case 0x00313134: // 411
            xs = 2;
            ys = 0;
            break;
        case 0x00303434: // 440
            xs = 0;
            ys = 1;
            break;
        default:
            err = 1;
            break;
        }
    } else switch (format) {
开发者ID:HermiG,项目名称:mplayer2,代码行数:51,代码来源:img_format.c

示例6: bswap_32

Bool16 QTAtom::ReadInt32To64Signed(UInt64 Offset, SInt64 * Datum)
{
	// General vars
	UInt32		tempDatum;

	//
	// Read and flip.
	if( !ReadBytes(Offset, (char *)&tempDatum, 4) )
		return false;
	
	tempDatum =  bswap_32(tempDatum);
	*Datum = (SInt64) (SInt32) tempDatum;
	return true;
}
开发者ID:AntoineHus,项目名称:dss,代码行数:14,代码来源:QTAtom.cpp

示例7: rhash_swap_copy_str_to_u32

/**
 * Copy a memory block with simultaneous exchanging byte order.
 * The byte order is changed from little-endian 32-bit integers
 * to big-endian (or vice-versa).
 *
 * @param to the pointer where to copy memory block
 * @param index the index to start writing from
 * @param from  the source block to copy
 * @param length length of the memory block
 */
void rhash_swap_copy_str_to_u32(void* to, int index, const void* from, size_t length)
{
	/* if all pointers and length are 32-bits aligned */
	if ( 0 == (( (int)((char*)to - (char*)0) | ((char*)from - (char*)0) | index | length ) & 3) ) {
		/* copy memory as 32-bit words */
		const uint32_t* src = (const uint32_t*)from;
		const uint32_t* end = (const uint32_t*)((const char*)src + length);
		uint32_t* dst = (uint32_t*)((char*)to + index);
		while (src < end) *(dst++) = bswap_32( *(src++) );
	} else {
		const char* src = (const char*)from;
		for (length += index; (size_t)index < length; index++) ((char*)to)[index ^ 3] = *(src++);
	}
}
开发者ID:AutomationInnwpu,项目名称:mentohust,代码行数:24,代码来源:byte_order.c

示例8: __glXBitmapReqSize

int
__glXBitmapReqSize( const GLbyte * pc, Bool swap )
{
    GLint row_length   = *  (GLint *)(pc +  4);
    GLint image_height = 0;
    GLint skip_images  = 0;
    GLint skip_rows    = *  (GLint *)(pc +  8);
    GLint alignment    = *  (GLint *)(pc + 16);
GLsizei width      = *(GLsizei *)(pc + 20);
GLsizei height     = *(GLsizei *)(pc + 24);

    if (swap) {
        row_length = bswap_32(row_length);
        skip_rows = bswap_32(skip_rows);
        alignment = bswap_32(alignment);
        width = bswap_32(width);
        height = bswap_32(height);
    }

    return __glXImageSize(GL_COLOR_INDEX, GL_BITMAP, 0, width, height, 1,
                          image_height, row_length, skip_images,
                          skip_rows, alignment);
}
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:23,代码来源:indirect_reqsize.c

示例9: ocfs2_swap_group_desc

void ocfs2_swap_group_desc(struct ocfs2_group_desc *gd)
{
	if (cpu_is_little_endian)
		return;

	gd->bg_size = bswap_16(gd->bg_size);
	gd->bg_bits = bswap_16(gd->bg_bits);
	gd->bg_free_bits_count = bswap_16(gd->bg_free_bits_count);
	gd->bg_chain = bswap_16(gd->bg_chain);
	gd->bg_generation = bswap_32(gd->bg_generation);
	gd->bg_next_group = bswap_64(gd->bg_next_group);
	gd->bg_parent_dinode = bswap_64(gd->bg_parent_dinode);
	gd->bg_blkno = bswap_64(gd->bg_blkno);
}
开发者ID:ystk,项目名称:debian-ocfs2-tools,代码行数:14,代码来源:chain.c

示例10:

Bool16 QTAtom::ReadInt32(UInt64 Offset, UInt32 * Datum)
{
    // General vars
    UInt32      tempDatum;


    //
    // Read and flip.
    if( !ReadBytes(Offset, (char *)&tempDatum, 4) )
        return false;
    
    *Datum = bswap_32(tempDatum);
    return true;
}
开发者ID:AntoineHus,项目名称:dss,代码行数:14,代码来源:QTAtom.cpp

示例11: fulltest

int fulltest(const unsigned char *hash, const unsigned char *target)
{
	uint32_t *hash32 = (uint32_t *)hash;
	uint32_t *target32 = (uint32_t *)target;
	int rc = 1;
	int i;

	for (i = 28 / 4; i >= 0; i--) {
		uint32_t h32tmp = bswap_32(hash32[i]);
		uint32_t t32tmp = bswap_32(target32[i]);

		if (h32tmp > t32tmp) {
			rc = NONCE_VALID;
			break;
		}
		if (h32tmp < t32tmp) {
			rc = NONCE_DIFF;
			break;
		}
	}

	return rc;
}
开发者ID:HashRatio,项目名称:mm-hashratio,代码行数:23,代码来源:miner.c

示例12: errormsg

char* errormsg(int* sbufLen,uint32_t transaction_id,char* error_msg) {

	int32_t action;
	int msgLen;

	action=3;
	msgLen = strlen(error_msg);
	*sbufLen = msgLen+8;
	char* sbuffer = malloc(*sbufLen);

	/* convert them to network order */
	#ifdef LITTLE_ENDIAN
	action = bswap_32(action);
	transaction_id = bswap_32(transaction_id);
	#endif		

	memcpy(sbuffer,&action,4);
	memcpy(sbuffer+4,&transaction_id,4);
	memcpy(sbuffer+8,&error_msg,msgLen);
	
	LOGMSG(LOG_INFO,"ERRORTransaction ID: %u Text: %s",transaction_id,error_msg);
	
	return sbuffer;
}
开发者ID:n0g,项目名称:racker,代码行数:24,代码来源:actions.c

示例13: LD_FILE_GETWORD

Word LD_FILE_GETWORD()
{
  Word tmp;
  if(sizeof(tmp)!=read(fd,&tmp,sizeof(tmp)))
    EM_THROW(LD_FILE_ReadError);
#if BYTE_ORDER == LITTLE_ENDIAN
# if __WORDSIZE == 32
  return (Word)bswap_32((unsigned int)tmp);
# elif __WORDSIZE == 64
  return bswap_64(tmp);
# endif
#elif BYTE_ORDER == BIG_ENDIAN
  return tmp;
#endif
}
开发者ID:Angeldude,项目名称:teyjus,代码行数:15,代码来源:file.c

示例14: ParcelDtor

/* de-serialize channels data from the parcel. return number of sources */
static int ParcelDtor(struct Manifest *manifest, char *parcel)
{
  struct NSParcel *p = (void*)parcel;
  int64_t end = bswap_32(p->bind_number) + bswap_32(p->connect_number);
  int64_t m = 0, n = 0;
  int64_t i;

  /* update channels sources from the parcel */
  for(i = 0; i < end; ++i)
  {
    struct Connection *c;
    NEXT_SRC();

    /* skip "binds" */
    if(i < bswap_32(p->bind_number)) continue;

    /* ip is already in network format for inet_ntoa */
    c->host = p->records[i].host;
    c->port = bswap_16(p->records[i].port);
  }

  g_free(parcel);
  return end;
}
开发者ID:painterjd,项目名称:zerovm-2.0,代码行数:25,代码来源:nservice.c

示例15: bswap_32

void DeepStarComponent::byteSwap( starData *stardata ) {
    stardata->RA = bswap_32( stardata->RA );
    stardata->Dec = bswap_32( stardata->Dec );
    stardata->dRA = bswap_32( stardata->dRA );
    stardata->dDec = bswap_32( stardata->dDec );
    stardata->parallax = bswap_32( stardata->parallax );
    stardata->HD = bswap_32( stardata->HD );
    stardata->mag = bswap_16( stardata->mag );
    stardata->bv_index = bswap_16( stardata->bv_index );
}
开发者ID:KDE,项目名称:kstars,代码行数:10,代码来源:deepstarcomponent.cpp


注:本文中的bswap_32函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。