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


C++ RoundUp4函数代码示例

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


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

示例1: switch

void ReceivedMessageArgumentIterator::Advance()
{
    if( !value_.typeTag_ )
        return;
        
    switch( *value_.typeTag_++ ){
        case '\0':
            // don't advance past end
            --value_.typeTag_;
            break;
            
        case TRUE_TYPE_TAG:
        case FALSE_TYPE_TAG:
        case NIL_TYPE_TAG:
        case INFINITUM_TYPE_TAG:
        case ARRAY_START_TYPE_TAG:
        case ARRAY_END_TYPE_TAG:

            // zero length
            break;

        case INT32_TYPE_TAG:
        case FLOAT_TYPE_TAG: 					
        case CHAR_TYPE_TAG:
        case RGBA_COLOR_TYPE_TAG:
        case MIDI_MESSAGE_TYPE_TAG:

            value_.argument_ += 4;
            break;

        case INT64_TYPE_TAG:
        case TIME_TAG_TYPE_TAG:
        case DOUBLE_TYPE_TAG:
				
            value_.argument_ += 8;
            break;

        case STRING_TYPE_TAG: 
        case SYMBOL_TYPE_TAG:

            // we use the unsafe function FindStr4End(char*) here because all of
            // the arguments have already been validated in
            // ReceivedMessage::Init() below.
            
            value_.argument_ = FindStr4End( value_.argument_ );
            break;

        case BLOB_TYPE_TAG:
            {
                uint32 blobSize = ToUInt32( value_.argument_ );
                value_.argument_ = value_.argument_ + 4 + RoundUp4( (unsigned long)blobSize );
            }
            break;

        default:    // unknown type tag
            // don't advance
            --value_.typeTag_;
            break;
    }
}
开发者ID:2mc,项目名称:supercollider,代码行数:60,代码来源:OscReceivedElements.cpp

示例2: RoundUp4

Errors OutboundPacketStream::CheckForAvailableArgumentSpace( std::size_t argumentLength )
{
    // plus three for extra type tag, comma and null terminator
    std::size_t required = (argumentCurrent_ - data_) + argumentLength
            + RoundUp4( (end_ - typeTagsCurrent_) + 3 );

    return (required > Capacity()) ? OUT_OF_BUFFER_MEMORY_ERROR : SUCCESS;
}
开发者ID:lalalaring,项目名称:UE4-OSC,代码行数:8,代码来源:OscOutboundPacketStream.cpp

示例3: Size

Errors OutboundPacketStream::CheckForAvailableMessageSpace( const char *addressPattern )
{
    // plus 4 for at least four bytes of type tag
    std::size_t required = Size() + ((ElementSizeSlotRequired())?4:0)
            + RoundUp4(std::strlen(addressPattern) + 1) + 4;

    return (required > Capacity()) ? OUT_OF_BUFFER_MEMORY_ERROR : SUCCESS;
}
开发者ID:lalalaring,项目名称:UE4-OSC,代码行数:8,代码来源:OscOutboundPacketStream.cpp

示例4: Size

void OutboundPacketStream::CheckForAvailableMessageSpace( const char *addressPattern )
{
    // plus 4 for at least four bytes of type tag
    unsigned long required = Size() + ((ElementSizeSlotRequired()) ? 4 : 0) + RoundUp4(static_cast<unsigned long>(strlen(addressPattern)) + 1) + 4;

    if( required > Capacity() )
        throw OutOfBufferMemoryException();
}
开发者ID:IsemanTech,项目名称:osg,代码行数:8,代码来源:OscOutboundPacketStream.cpp

示例5: Size

	void NxDeviceOscOutputMessage::CheckForAvailableMessageSpace( const char *addressPattern )
	{
		// plus 4 for at least four bytes of type tag
		unsigned long required = Size() + ((ElementSizeSlotRequired())?4:0)
			+ RoundUp4(strlen(addressPattern) + 1) + 4;

		if( required > Capacity() )
			throw OutOfBufferMemoryException();
	}
开发者ID:nxgraphics,项目名称:NxGraphics,代码行数:9,代码来源:NxDevice_Device_OscOutputMsg.cpp

示例6: RoundUp4

void OutboundPacketStream::CheckForAvailableArgumentSpace( long argumentLength )
{
    // plus three for extra type tag, comma and null terminator
     unsigned long required = (argumentCurrent_ - data_) + argumentLength
            + RoundUp4( (end_ - typeTagsCurrent_) + 3 );

    if( required > Capacity() )
        throw OutOfBufferMemoryException();
}
开发者ID:CPonty,项目名称:reactivision-midi-server,代码行数:9,代码来源:OscOutboundPacketStream.cpp

示例7: if

int GetPropertyReplyStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
                                              unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
                                                  ChannelCache *channelCache) const
{
  ServerCache *serverCache = (ServerCache *) channelCache;

  #ifdef DEBUG
  *logofs << name() << ": Decoding full message identity.\n"
          << logofs_flush;
  #endif

  unsigned char format;

  decodeBuffer.decodeCachedValue(format, 8,
                     serverCache -> getPropertyFormatCache);

  unsigned int length;

  decodeBuffer.decodeValue(length, 32, 9);

  unsigned int numBytes = length;

  if (format == 16)
  {
    numBytes <<= 1;
  }
  else if (format == 32)
  {
    numBytes <<= 2;
  }

  size = 32 + RoundUp4(numBytes);

  buffer = writeBuffer -> addMessage(size);

  *(buffer + 1) = format;

  PutULONG(length, buffer + 16, bigEndian);

  unsigned int value;

  decodeBuffer.decodeCachedValue(value, 29,
                     serverCache -> getPropertyTypeCache, 9);

  PutULONG(value, buffer + 8, bigEndian);

  decodeBuffer.decodeValue(value, 32, 9);

  PutULONG(value, buffer + 12, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Decoded full message identity.\n"
          << logofs_flush;
  #endif

  return 1;
}
开发者ID:narenas,项目名称:nx-libs,代码行数:57,代码来源:GetPropertyReply.cpp

示例8: MessageNotInProgressException

OutboundPacketStream& OutboundPacketStream::operator<<( const MessageTerminator& rhs )
{
    (void) rhs;

    if( !IsMessageInProgress() )
        throw MessageNotInProgressException();

    int typeTagsCount = end_ - typeTagsCurrent_;

    if( typeTagsCount ){

        char *tempTypeTags = (char*)alloca(typeTagsCount);
        memcpy( tempTypeTags, typeTagsCurrent_, typeTagsCount );

        // slot size includes comma and null terminator
        int typeTagSlotSize = RoundUp4( typeTagsCount + 2 );

        uint32 argumentsSize = argumentCurrent_ - messageCursor_;

        memmove( messageCursor_ + typeTagSlotSize, messageCursor_, argumentsSize );

        messageCursor_[0] = ',';
        // copy type tags in reverse (really forward) order
        for( int i=0; i < typeTagsCount; ++i )
            messageCursor_[i+1] = tempTypeTags[ (typeTagsCount-1) - i ];

        char *p = messageCursor_ + 1 + typeTagsCount;
        for( int i=0; i < (typeTagSlotSize - (typeTagsCount + 1)); ++i )
            *p++ = '\0';

        typeTagsCurrent_ = end_;

        // advance messageCursor_ for next message
        messageCursor_ += typeTagSlotSize + argumentsSize;

    }else{
        // send an empty type tags string
        memcpy( messageCursor_, ",\0\0\0", 4 );

        // advance messageCursor_ for next message
        messageCursor_ += 4;
    }

    argumentCurrent_ = messageCursor_;

    EndElement( messageCursor_ );

    messageIsInProgress_ = false;

    return *this;
}
开发者ID:CPonty,项目名称:reactivision-midi-server,代码行数:51,代码来源:OscOutboundPacketStream.cpp

示例9: RoundUp4

int SetUnpackColormapStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer,
                                               unsigned int &size, int bigEndian, WriteBuffer *writeBuffer,
                                                   ChannelCache *channelCache) const
{
  ClientCache *clientCache = (ClientCache *) channelCache;

  #ifdef DEBUG
  *logofs << name() << ": Decoding full message identity.\n" << logofs_flush;
  #endif

  unsigned int  value;
  unsigned char cValue;

  // SrcLength.
  decodeBuffer.decodeValue(value, 32, 9);

  size = RoundUp4(value) + 16;

  buffer = writeBuffer -> addMessage(size);

  PutULONG(value, buffer + 8, bigEndian);

  // Client.
  decodeBuffer.decodeCachedValue(cValue, 8,
                     clientCache -> resourceCache);

  *(buffer + 1) = cValue;

  // Method.
  decodeBuffer.decodeCachedValue(cValue, 8,
                     clientCache -> methodCache);

  *(buffer + 4) = cValue;

  // DstLength.
  decodeBuffer.decodeValue(value, 32, 9);

  PutULONG(value, buffer + 12, bigEndian);

  #ifdef DEBUG
  *logofs << name() << ": Decoded full message identity.\n" << logofs_flush;
  #endif

  return 1;
}
开发者ID:narenas,项目名称:nx-libs,代码行数:45,代码来源:SetUnpackColormap.cpp

示例10: CheckForAvailableArgumentSpace

OutboundPacketStream& OutboundPacketStream::operator<<(const char* rhs)
{
    CheckForAvailableArgumentSpace(RoundUp4(static_cast<long>(strlen(rhs)) + 1));

    *--typeTagsCurrent_ = STRING_TYPE_TAG;
    strcpy(argumentCurrent_, rhs);
    unsigned long rhsLength = static_cast<unsigned long>(strlen(rhs));
    argumentCurrent_ += rhsLength + 1;

    // zero pad to 4-byte boundary
    unsigned long i = rhsLength + 1;
    while (i & 0x3) {
        *argumentCurrent_++ = '\0';
        ++i;
    }

    return *this;
}
开发者ID:CasparCG,项目名称:Server,代码行数:18,代码来源:OscOutboundPacketStream.cpp

示例11: CheckForAvailableArgumentSpace

	NxDeviceOscOutputMessage& NxDeviceOscOutputMessage::operator<<( const char *rhs )
	{
		CheckForAvailableArgumentSpace( RoundUp4(strlen(rhs) + 1) );

		*(--typeTagsCurrent_) = STRING_TYPE_TAG;
		strcpy( argumentCurrent_, rhs );
		unsigned long rhsLength = strlen(rhs);
		argumentCurrent_ += rhsLength + 1;

		// zero pad to 4-byte boundary
		unsigned long i = rhsLength + 1;
		while( i & 0x3 ){
			*argumentCurrent_++ = '\0';
			++i;
		}

		return *this;
	}
开发者ID:nxgraphics,项目名称:NxGraphics,代码行数:18,代码来源:NxDevice_Device_OscOutputMsg.cpp

示例12: CheckForAvailableArgumentSpace

OutboundPacketStream& OutboundPacketStream::operator<<( const char *rhs )
{
    CheckForAvailableArgumentSpace( RoundUp4(std::strlen(rhs) + 1) );

    *(--typeTagsCurrent_) = STRING_TYPE_TAG;
    std::strcpy( argumentCurrent_, rhs );
    std::size_t rhsLength = std::strlen(rhs);
    argumentCurrent_ += rhsLength + 1;

    // zero pad to 4-byte boundary
    std::size_t i = rhsLength + 1;
    while( i & 0x3 ){
        *argumentCurrent_++ = '\0';
        ++i;
    }

    return *this;
}
开发者ID:OpenDAWN,项目名称:eear,代码行数:18,代码来源:OscOutboundPacketStream.cpp

示例13: CheckForAvailableArgumentSpace

OutboundPacketStream& OutboundPacketStream::operator<<( const Symbol& rhs )
{
    CheckForAvailableArgumentSpace( RoundUp4(strlen(rhs) + 1) );

    *(--typeTagsCurrent_) = SYMBOL_TYPE_TAG;
    strcpy( argumentCurrent_, rhs );
    unsigned long rhsLength = strlen(rhs);
    argumentCurrent_ += rhsLength + 1;

    // zero pad to 4-byte boundary
    unsigned long i = rhsLength + 1;
    while( i & 0x3 ){
        *argumentCurrent_++ = '\0';
        ++i;
    }

    return *this;
}
开发者ID:CPonty,项目名称:reactivision-midi-server,代码行数:18,代码来源:OscOutboundPacketStream.cpp

示例14: CheckForAvailableArgumentSpace

OutboundPacketStream& OutboundPacketStream::operator<<( const Symbol& rhs )
{
    state_ = CheckForAvailableArgumentSpace( RoundUp4(std::strlen(rhs) + 1) );
    if(state_ == SUCCESS)
    {
        *(--typeTagsCurrent_) = SYMBOL_TYPE_TAG;
        std::strcpy( argumentCurrent_, rhs );
        std::size_t rhsLength = std::strlen(rhs);
        argumentCurrent_ += rhsLength + 1;

        // zero pad to 4-byte boundary
        std::size_t i = rhsLength + 1;
        while( i & 0x3 ){
            *argumentCurrent_++ = '\0';
            ++i;
        }
    }

    return *this;
}
开发者ID:lalalaring,项目名称:UE4-OSC,代码行数:20,代码来源:OscOutboundPacketStream.cpp

示例15: RoundUpForPixelSize

static int32 RoundUpForPixelSize (uint32 x, uint32 pixelSize)
	{
	
	switch (pixelSize)
		{
		
		case 1:
			return RoundUp16 (x);
			
		case 2:
			return RoundUp8 (x);
			
		case 4:
			return RoundUp4 (x);
			
		case 8:
			return RoundUp2 (x);
			
		default:
			return RoundUp16 (x);
					
		}
	
	}
开发者ID:ruphy,项目名称:kipi-plugins,代码行数:24,代码来源:dng_filter_task.cpp


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