• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LOG2函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ifs

bool Inventory::readRecipe(const std::string& recipeFile)
{
  std::ifstream ifs(recipeFile.c_str());

  if (ifs.fail())
  {
    LOG2(ERROR, "Could not find: " + recipeFile);
    ifs.close();
    return false;
  }

  //LOG(INFO, "Inventory", "Reading: " + recipeFile);

  std::string temp;

  int height = 0, width = 0, outCount = 0;
  int16_t outType = 0, outHealth = 0;

  // Reading row at a time
  int del;
  bool readingRecipe = false;
  std::vector<std::string> line;
  std::vector<ItemPtr> recipetable;
  std::string text;
  while (getline(ifs, temp))
  {
    //If empty line
    if (temp.empty())
    {
      continue;
    }

    // If commentline -> skip to next
    if (temp[0] == COMMENTPREFIX)
    {
      continue;
    }

    // Init vars
    del = 0;
    line.clear();

    // Process line
    while (!temp.empty())
    {
      // Remove white spaces
      while (temp[0] == ' ')
      {
        temp = temp.substr(1);
      }

      // Split words
      del = temp.find(' ');
      if (del > -1)
      {
        line.push_back(temp.substr(0, del));
        temp = temp.substr(del + 1);
      }
      else
      {
        line.push_back(temp);
        break;
      }
    }

    // Begin recipe
    if (line.size() == 1 && line[0] == "<-")
    {
      readingRecipe = true;
      continue;
    }
    // Begin recipe
    if (line.size() == 1 && line[0] == "->")
    {
      readingRecipe = false;
      continue;
    }

    if (readingRecipe)
    {
      for (unsigned int i = 0; i < line.size(); i++)
      {
        std::string data(line[i]);
        ItemPtr item(new Item);
        item->setCount(1);
        item->setHealth(-1);
        int location = data.find("x");
        if (location > -1)
        {
          // Quantity before ID
          item->setCount(atoi(data.substr(0, location).c_str()));
          data = data.substr(location + 1, std::string::npos);
        }
        location = data.find(":");
        if (location > -1)
        {
          // Meta after ID
          item->setHealth(atoi(data.substr(location + 1, std::string::npos).c_str()));
          data = data.substr(0, location);
        }
//.........这里部分代码省略.........
开发者ID:Justasic,项目名称:mineserver,代码行数:101,代码来源:inventory.cpp


示例2: ASSERT

//---------------------------------------------------------------------------
//
//	バイト書き込み
//
//---------------------------------------------------------------------------
void FASTCALL CRTC::WriteByte(uint32_t addr, uint32_t data)
{
	int reg;

	ASSERT(this);
	ASSERT((addr >= memdev.first) && (addr <= memdev.last));

	// $800単位でループ
	addr &= 0x7ff;

	// ウェイト
	scheduler->Wait(1);

	// $E80000-$E803FF : レジスタエリア
	if (addr < 0x400) {
		addr &= 0x3f;
		if (addr >= 0x30) {
			return;
		}

		// 書き込み(エンディアンを反転させる)
		addr ^= 1;
		if (crtc.reg[addr] == data) {
			return;
		}
		crtc.reg[addr] = (uint8_t)data;

		// GVRAMアドレス構成
		if (addr == 0x29) {
			if (data & 0x10) {
				crtc.tmem = TRUE;
			}
			else {
				crtc.tmem = FALSE;
			}
			if (data & 0x08) {
				crtc.gmem = TRUE;
			}
			else {
				crtc.gmem = FALSE;
			}
			crtc.siz = (data & 4) >> 2;
			crtc.col = (data & 3);

			// グラフィックVRAMへ通知
			gvram->SetType(data & 0x0f);
			return;
		}

		// 解像度変更
		if ((addr <= 15) || (addr == 40)) {
			// スプライトメモリの接続・切断は瞬時に行う(OS-9/68000)
			if (addr == 0x28) {
				if ((crtc.reg[0x28] & 3) >= 2) {
					sprite->Connect(FALSE);
				}
				else {
					sprite->Connect(TRUE);
				}
			}

			// 次の周期で再計算
			crtc.changed = TRUE;
			return;
		}

		// ラスタ割り込み
		if ((addr == 18) || (addr == 19)) {
			crtc.raster_int = (crtc.reg[19] << 8) + crtc.reg[18];
			crtc.raster_int &= 0x3ff;
			CheckRaster();
			return;
		}

		// テキストスクロール
		if ((addr >= 20) && (addr <= 23)) {
			crtc.text_scrlx = (crtc.reg[21] << 8) + crtc.reg[20];
			crtc.text_scrlx &= 0x3ff;
			crtc.text_scrly = (crtc.reg[23] << 8) + crtc.reg[22];
			crtc.text_scrly &= 0x3ff;
			render->TextScrl(crtc.text_scrlx, crtc.text_scrly);

			CRTC_LOG(LOG2(Log::Normal, "テキストスクロール x=%d y=%d", crtc.text_scrlx, crtc.text_scrly));
			return;
		}

		// グラフィックスクロール
		if ((addr >= 24) && (addr <= 39)) {
			reg = addr & ~3;
			addr -= 24;
			addr >>= 2;
			ASSERT(addr <= 3);
			crtc.grp_scrlx[addr] = (crtc.reg[reg+1] << 8) + crtc.reg[reg+0];
			crtc.grp_scrly[addr] = (crtc.reg[reg+3] << 8) + crtc.reg[reg+2];
			if (addr == 0) {
//.........这里部分代码省略.........
开发者ID:ysei,项目名称:XM6_pid,代码行数:101,代码来源:crtc.cpp


示例3: LOG2

///询价通知
void CMdSpi::OnRtnForQuoteRsp(CThostFtdcForQuoteRspField *pForQuoteRsp)
{
	LOG2("Subscribed Quote Response for InstrmentID: ", pForQuoteRsp->InstrumentID);
}
开发者ID:alliswellpo,项目名称:CppWork,代码行数:5,代码来源:MdSpi.cpp


示例4: freeSpace

TWmDrmStoreState CWmDrmDataStore::DataStoreStateL()
    {
    TWmDrmStoreState state;
    TInt64 freeSpace( 0 );
    TInt64 freeSpace2( 0 );
    TInt dataStoreSize( 0 );
    TInt dummyDbSize( 0 );
    TInt ratio( 0 );
    TInt ratio2( 0 );
    TBool internalMassDriveNotFull( ETrue );

    LOGFN( "CWmDrmDataStore::DataStoreStateL" );
    freeSpace = iServer->FreeSpaceL( EFalse );

    if ( iWmDrmRightsConfigFound )
        {
        // Check free space from the configured drive, too.
        freeSpace2 = iServer->FreeSpaceL( ETrue );

        if ( freeSpace2 < iMinFreeSpace2 )
            {
            internalMassDriveNotFull = EFalse;
            }

        dummyDbSize = DummyDBSizeL( ETrue );
        dataStoreSize = DataStoreSizeL( ETrue );
        ratio2 = dataStoreSize * 100 / iInitialFreeSpace2;
        freeSpace2 += dummyDbSize;
#ifdef _LOGGING
        TBuf<KMaxTInt64BufLength> free2;
        LOG1( "CWmDrmDataStore::DataStoreStateL: Free space (2): ");
        free2.AppendNumUC( freeSpace2, EDecimal );
        LOG( free2 );
        TBuf<KMaxTInt64BufLength> free2Min;
        LOG1( "CWmDrmDataStore::DataStoreStateL: Minimum free space (2): ");
        free2Min.AppendNumUC( iMinFreeSpace2, EDecimal );
        LOG( free2Min );
#endif
        }

    // Check the system drive storage space next.
    dummyDbSize = DummyDBSizeL( EFalse );
    dataStoreSize = DataStoreSizeL( EFalse );
    ratio = dataStoreSize * 100 / iInitialFreeSpace;
    freeSpace += dummyDbSize;
#ifdef _LOGGING
    TBuf<KMaxTInt64BufLength> free;
    LOG1( "CWmDrmDataStore::DataStoreStateL: Free space: ");
    free.AppendNumUC( freeSpace, EDecimal );
    LOG( free );
    TBuf<KMaxTInt64BufLength> freeMin;
    LOG1( "CWmDrmDataStore::DataStoreStateL: Minimum free space: ");
    freeMin.AppendNumUC( iMinFreeSpace, EDecimal );
    LOG( freeMin );
#endif

    // Select the state of the storage space.
    if ( ( freeSpace > iMinFreeSpace ) && internalMassDriveNotFull )
        {
        LOG1( "CWmDrmDataStore::DataStoreStateL: Store space Ok" );
        state = EStoreSpaceOK;
        }
    else
        {
        // The configured drive is running out of space. The system drive
        // may also be running out of storage space, but calculate
        // the ratio of database size to initial free drive space and the
        // state of the drive storage space from the configured drive because
        // it is likely to fill up faster since the media files may be synced to it.
        if ( !internalMassDriveNotFull )
            {
            LOG2( "Ratio (2): %d", ratio2 );
            if ( ratio2 <= iMaxSpaceRatio2 )
                {
                LOG1( "CWmDrmDataStore::DataStoreStateL: Store space low (2)" );
                state = EStoreSpaceLow;
                }
            else
                {
                LOG1( "CWmDrmDataStore::DataStoreStateL: Store space full (2)" );
                state = EStoreSpaceFull;
                }
            }
        else
            // Only the system drive is running out of storage space.
            {
            LOG2( "Ratio: %d", ratio );
            if ( ratio <= iMaxSpaceRatio )
                {
                LOG1( "CWmDrmDataStore::DataStoreStateL Store space low" );
                state = EStoreSpaceLow;
                }
            else
                {
                LOG1( "CWmDrmDataStore::DataStoreStateL Store space full" );
                state = EStoreSpaceFull;
                }
            }
        }

//.........这里部分代码省略.........
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:101,代码来源:wmdrmdatastore.cpp


示例5: get_pool

 int get_pool() { return LOG2(ItemSize)-4; }
开发者ID:bytemaster,项目名称:fc_malloc,代码行数:1,代码来源:fixed_pool.hpp


示例6: if

void apollo_kbd_device::mouse::read_mouse()
{
	if (m_tx_pending > 0)
	{
		m_tx_pending -= 5; // we will be called every 5ms
	}
	else
	{
		int b = m_device->m_io_mouse1->read();
		int x = m_device->m_io_mouse2->read();
		int y = m_device->m_io_mouse3->read();

		/* sign extend values < 0 */
		if (x & 0x80)
			x |= 0xffffff00;
		if (y & 0x80)
			y |= 0xffffff00;
		y = -y;

		if (m_last_b < 0)
		{
			m_last_b = b;
			m_last_x = x;
			m_last_y = y;
		}
		else if (b != m_last_b || x != m_last_x || y != m_last_y)
		{
			UINT8 mouse_data[4];
			int mouse_data_size;

			int dx = x - m_last_x;
			int dy = y - m_last_y;

			LOG2(("read_mouse: b=%02x x=%d y=%d dx=%d dy=%d", b, x, y, dx, dy));

			if (m_device->m_mode == KBD_MODE_0_COMPATIBILITY)
			{
				mouse_data[0] = 0xdf;
				mouse_data[1] = 0xf0 ^ b;
				mouse_data[2] = dx;
				mouse_data[3] = dy;
				mouse_data_size = 4;
			}
			else
			{
				if (m_device->m_mode != KBD_MODE_2_RELATIVE_CURSOR_CONTROL)
				{
					m_device->set_mode(KBD_MODE_2_RELATIVE_CURSOR_CONTROL);
				}

				mouse_data[0] = 0xf0 ^ b;
				mouse_data[1] = dx;
				mouse_data[2] = dy;
				mouse_data_size = 3;
			}

			for (int md = 0; md < mouse_data_size; md++)
			{
				m_device->xmit_char(mouse_data[md]);
			}

			// mouse data submitted; update current mouse state
			m_last_b = b;
			m_last_x += dx;
			m_last_y += dy;
			m_tx_pending = 100; // mouse data packet will take 40 ms
		}
	}
}
开发者ID:DragonMinded,项目名称:mame,代码行数:69,代码来源:apollo_kbd.cpp


示例7: blk_get_device_part_str


//.........这里部分代码省略.........
		 * Less than whole string converted,
		 * or request for whole device, but caller requires partition.
		 */
		if (*ep || (part == 0 && !allow_whole_dev)) {
			printf("** Bad partition specification %s %s **\n",
			    ifname, dev_part_str);
			goto cleanup;
		}
	}

	/*
	 * No partition table on device,
	 * or user requested partition 0 (entire device).
	 */
	if (((*dev_desc)->part_type == PART_TYPE_UNKNOWN) ||
	    (part == 0)) {
		if (!(*dev_desc)->lba) {
			printf("** Bad device size - %s %s **\n", ifname,
			       dev_str);
			goto cleanup;
		}

		/*
		 * If user specified a partition ID other than 0,
		 * or the calling command only accepts partitions,
		 * it's an error.
		 */
		if ((part > 0) || (!allow_whole_dev)) {
			printf("** No partition table - %s %s **\n", ifname,
			       dev_str);
			goto cleanup;
		}

		(*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz);

		part_get_info_whole_disk(*dev_desc, info);

		ret = 0;
		goto cleanup;
	}

	/*
	 * Now there's known to be a partition table,
	 * not specifying a partition means to pick partition 1.
	 */
	if (part == PART_UNSPECIFIED)
		part = 1;

	/*
	 * If user didn't specify a partition number, or did specify something
	 * other than "auto", use that partition number directly.
	 */
	if (part != PART_AUTO) {
		ret = part_get_info(*dev_desc, part, info);
		if (ret) {
			printf("** Invalid partition %d **\n", part);
			goto cleanup;
		}
	} else {
		/*
		 * Find the first bootable partition.
		 * If none are bootable, fall back to the first valid partition.
		 */
		part = 0;
		for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
			ret = part_get_info(*dev_desc, p, info);
开发者ID:Noltari,项目名称:u-boot,代码行数:67,代码来源:part.c


示例8: clear_sense_data

static void clear_sense_data(omti8621_state *state) {
	LOG2(("clear_sense_data"));
	memset(state->sense_data, 0, sizeof(state->sense_data));
}
开发者ID:clobber,项目名称:UME,代码行数:4,代码来源:omti8621.c


示例9: LOG2

void FaceDetector::skinTypeDetect(ia_frame *frame)
{
    LOG2("@%s", __FUNCTION__);
    Mutex::Autolock lock(mLock);
    ia_face_detect_skin(mContext, frame);
}
开发者ID:yutokt,项目名称:android_vendor_intel,代码行数:6,代码来源:FaceDetector.cpp


示例10: LOG

void CMMADisplay::SourceSizeChanged(const TSize& aSourceSize)
{
    LOG(EJavaMMAPI,EInfo,"CMMADisplay::SourceSizeChanged");

#ifdef RD_JAVA_NGA_ENABLED
    if (iWindow)
    {
        iWindow->SetVideoCropRegion(TRect(iUserRect.iTl, aSourceSize));
    }
#endif

    iSourceSize = aSourceSize;
    LOG1(EJavaMMAPI,EInfo,"MMA::CMMADisplay::SourceSizeChanged %d",
         aSourceSize.iWidth);
    LOG1(EJavaMMAPI,EInfo,"MMA::CMMADisplay::SourceSizeChanged %d",
         aSourceSize.iHeight);
    jmethodID getDisplayWidthID = iJni->GetMethodID(
                                      iJavaDisplayClass,
                                      "getDisplayWidth",
                                      "()I");

    jmethodID getDisplayHeightID = iJni->GetMethodID(
                                       iJavaDisplayClass,
                                       "getDisplayHeight",
                                       "()I");


    TInt x =  iJni->CallIntMethod(iJavaDisplayObject,getDisplayWidthID);
    TInt y = iJni->CallIntMethod(iJavaDisplayObject,getDisplayHeightID);
    LOG2(EJavaMMAPI,EInfo,"CMMADisplay.cpp : SourceSizeChanged () iFullScreenSize is x = %d ,y = %d ",x,y);
    // get the ScreenSize from canvas in java
    TSize canvasSize(x, y);
    iFullScreenSize = canvasSize;
    TBool sourceIsBigger = (aSourceSize.iWidth > iFullScreenSize.iWidth ||
                            aSourceSize.iHeight > iFullScreenSize.iHeight);

    if (sourceIsBigger)
    {
        // Source is larger than display area.
        // Shrink draw are to fit in display.
        iWindow->SetDrawRect(ScaleToFullScreen(iFullScreenSize, iSourceSize));
    }
    else
    {
        // source is smaller than display area
        iWindow->SetDrawRect(TRect(iUserRect.iTl, iSourceSize));
    }

    SetClippingRegion();

    if (iUserRect.IsEmpty())
    {
        // Java side hasn't set size.
        iUserRect = iWindow->DrawRect();

        if (!sourceIsBigger)
        {
            // Addjusting rect to top left corner.
            iUserRect = TRect(iUserRect.Size());
        }
    }
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:62,代码来源:cmmadisplay.cpp


示例11: set_interrupt

static void set_interrupt(const omti8621_state *state, enum line_state line_state) {
	if (state->irq_handler != NULL) {
		LOG2(("set_interrupt: status_port=%x", state->status_port));
		(*state->irq_handler)(&state->device->machine(), line_state);
	}
}
开发者ID:clobber,项目名称:UME,代码行数:6,代码来源:omti8621.c


示例12: kernelOuter

	bool DiffOfGaussianKernel<T, U>::Initialize_()
	{
		//if (m_dimension<5) return false;

		// create two gaussian deriv kernels

		PGCore::GaussianKernel<T, U> kernelOuter(m_sigmaOuter, m_dimension);
		PGCore::GaussianKernel<T, U> kernelInner(m_sigmaInner, m_dimension);
	
		

		kernelOuter-= kernelInner;
		
		memcpy(m_buffer, kernelOuter.GetBuffer(), m_dimension*sizeof(float));
		
		for(int i=0;i<(m_dimension);i++)
		{
			m_buffer[i]*=10;//m_dimension;		
		}
		

		/*
		float sum=0;
		for(int i=0;i<(m_dimension);i++)
		{
			m_buffer[i]*=50;//m_dimension;
			sum += m_buffer[i];			
		}
		
		if (sum<0)
		{
			float offset=abs(sum)/m_dimension;
			for (int i=0; i<(m_dimension); i++)
			{
				m_buffer[i] = offset;
			}			
		}		
		*/

#ifdef _DEBUG
		LOG0("{ The filter coefficients difference of gaussian are:");
		for(int i=0;i<(m_dimension);i++)
		{
			LOG2("Kernel[%d] = %f", i, (double)m_buffer[i]);
		}
		LOG0("} The filter coefficients.");
#endif

		//Reset()

		// experimental
		//  0	-1	-2	 -1	 0
		// -1	-2	-4	 -2	 1
		// -2	-4	 0	  4	 2
		// -1	 2	 4	  2	 1
		//  0	 1	 2	  1	 0
/*
		if (!m_orientY)
		{

			// fill up the buffer here
			SetValue(1, 0, (T)(-1.0f)); SetValue(3, 0, (T)(-1.0f));
			SetValue(1, 1, (T)(-2.0f)); SetValue(3, 1, (T)(-2.0f));
			SetValue(1, 3, (T)(2.0f));  SetValue(3, 3, (T)(2.0f));
			SetValue(1, 4, (T)(1.0f));  SetValue(3, 4, (T)(1.0f));

			SetValue(2, 0, (T)(-2.0f)); 
			SetValue(2, 1, (T)(-4.0f)); 
			SetValue(2, 3, (T)(4.0f));  
			SetValue(2, 4, (T)(2.0f));  

		} else
		{
			// fill up the buffer here
			SetValue(0, 1, (T)(-1.0f)); SetValue(0, 3, (T)(-1.0f));
			SetValue(1, 1, (T)(-2.0f)); SetValue(1, 3, (T)(-2.0f));
			SetValue(3, 1, (T)(2.0f));  SetValue(3, 3, (T)(2.0f));
			SetValue(4, 1, (T)(1.0f));  SetValue(4, 3, (T)(1.0f));

			SetValue(0, 2, (T)(-2.0f)); 
			SetValue(1, 2, (T)(-4.0f)); 
			SetValue(3, 2, (T)(4.0f));  
			SetValue(4, 2, (T)(2.0f));  

		}*/
		return true;
	}
开发者ID:yangguang-ecnu,项目名称:smisdk,代码行数:87,代码来源:DiffOfGaussianKernel.cpp


示例13: client_callback

void client_callback(int fd,
                     short ev,
                     void* arg)
{
  User* user = (User*)arg;
  /*
  std::vector<User *>::const_iterator it = std::find (Mineserver::get()->users().begin(),
                                                      Mineserver::get()->users().end(), user);
  if(it == Mineserver::get()->users().end())
  {
    LOG2(INFO, "Using dead player!!!");
    return;
  }
  */
  if (ev & EV_READ)
  {

    int read   = 1;

    uint8_t* buf = new uint8_t[2048];

    read = recv(fd, (char*)buf, 2048, 0);
    if (read == 0)
    {
      LOG2(INFO, "Socket closed properly");

      delete user;
      user = (User*)1;
      delete[] buf;
      return;
    }

    if (read == SOCKET_ERROR)
    {
      LOG2(INFO, "Socket had no data to read");

      delete user;
      user = (User*)2;
      delete[] buf;
      return;
    }

    user->lastData = time(NULL);

    user->buffer.addToRead(buf, read);

    delete[] buf;

    user->buffer.reset();

    while (user->buffer >> (int8_t&)user->action)
    {
      //Variable len package
      if (Mineserver::get()->packetHandler()->packets[user->action].len == PACKET_VARIABLE_LEN)
      {
        //Call specific function
        int (PacketHandler::*function)(User*) =
          Mineserver::get()->packetHandler()->packets[user->action].function;
        bool disconnecting = user->action == 0xFF;
        int curpos = (Mineserver::get()->packetHandler()->*function)(user);
        if (curpos == PACKET_NEED_MORE_DATA)
        {
          user->waitForData = true;
          event_set(user->GetEvent(), fd, EV_READ, client_callback, user);
          event_add(user->GetEvent(), NULL);
          return;
        }

        if (disconnecting) // disconnect -- player gone
        {
          delete user;
          user = (User*)4;
          return;
        }
      }
      else if (Mineserver::get()->packetHandler()->packets[user->action].len == PACKET_DOES_NOT_EXIST)
      {
        std::ostringstream str;
        str << "Unknown action: 0x" << std::hex << user->action;
        LOG2(DEBUG, str.str());

        delete user;
        user = (User*)3;
        return;
      }
      else
      {
        if (!user->buffer.haveData(Mineserver::get()->packetHandler()->packets[user->action].len))
        {
          user->waitForData = true;
          event_set(user->GetEvent(), fd, EV_READ, client_callback, user);
          event_add(user->GetEvent(), NULL);
          return;
        }

        //Call specific function
        int (PacketHandler::*function)(User*) = Mineserver::get()->packetHandler()->packets[user->action].function;
        (Mineserver::get()->packetHandler()->*function)(user);
      }
    } //End while
//.........这里部分代码省略.........
开发者ID:ThuGie,项目名称:mineserver,代码行数:101,代码来源:sockets.cpp


示例14: switch

bool Inventory::canBeArmour(int slot, int type)
{
  if (slot == 5)
  {
    // Helmet slot. Lots of fun here
    if (ServerInstance->m_only_helmets)
    {
      switch (type)
      {
      case ITEM_LEATHER_HELMET:
      case ITEM_CHAINMAIL_HELMET:
      case ITEM_IRON_HELMET:
      case ITEM_DIAMOND_HELMET:
      case ITEM_GOLD_HELMET:
        return true;
        break;
      }
      return false;
    }
    else
    {
      return true;
    }
  }
  else if (slot == 6)
  {
    switch (type)
    {
    case ITEM_LEATHER_CHESTPLATE:
    case ITEM_CHAINMAIL_CHESTPLATE:
    case ITEM_IRON_CHESTPLATE:
    case ITEM_DIAMOND_CHESTPLATE:
    case ITEM_GOLD_CHESTPLATE:
      return true;
      break;
    }
    return false;
  }
  else if (slot == 7)
  {
    switch (type)
    {
    case ITEM_LEATHER_LEGGINGS:
    case ITEM_CHAINMAIL_LEGGINGS:
    case ITEM_IRON_LEGGINGS:
    case ITEM_DIAMOND_LEGGINGS:
    case ITEM_GOLD_LEGGINGS:
      return true;
      break;
    }
    return false;
  }
  else if (slot == 8)
  {
    switch (type)
    {
    case ITEM_LEATHER_BOOTS:
    case ITEM_CHAINMAIL_BOOTS:
    case ITEM_IRON_BOOTS:
    case ITEM_DIAMOND_BOOTS:
    case ITEM_GOLD_BOOTS:
      return true;
      break;
    }
    return false;
  }
  LOG2(WARNING, "Unknown armour slot.");
  return false;
}
开发者ID:Justasic,项目名称:mineserver,代码行数:69,代码来源:inventory.cpp


示例15: LOG2

void apollo_kbd_device::beeper::reset()
{
	LOG2(("reset apollo_kbd::beeper"));
	on();
}
开发者ID:DragonMinded,项目名称:mame,代码行数:5,代码来源:apollo_kbd.cpp


示例16: mFaceDetector

// FaceDBLoaderThread interface defination.
FaceDetector::FaceDBLoaderThread::FaceDBLoaderThread(FaceDetector* faceDetector) :
    mFaceDetector(faceDetector)
{
    LOG2("@%s", __FUNCTION__);
}
开发者ID:yutokt,项目名称:android_vendor_intel,代码行数:6,代码来源:FaceDetector.cpp


示例17: BIT

int apollo_kbd_device::push_scancode(UINT8 code, UINT8 repeat)
{
	int n_chars = 0;
	UINT16 key_code = 0;
	UINT8 caps = BIT(machine().root_device().ioport("keyboard4")->read(),0);
	UINT8 shift = BIT(machine().root_device().ioport("keyboard4")->read(),1) | BIT(machine().root_device().ioport("keyboard4")->read(),5);
	UINT8 ctrl = BIT(machine().root_device().ioport("keyboard4")->read(),2);
	UINT8 numlock = BIT(machine().root_device().ioport("keyboard4")->read(),6);
	UINT16 index;

	if (keyboard_is_german())
	{
		// map special keys for German keyboard
		switch (code)
		{
		case 0x00: code = 0x68; break; // _
		case 0x0e: code = 0x6b; break; // #
		case 0x29: code = 0x69; break; // <>
		case 0x42: code = 0x6f; break; // NP-
		case 0x46: code = 0x6e; break; // NP+
		case 0x4e: code = 0x73; break; // NP ENTER
		}
	}

#if MAP_APOLLO_KEYS
	if (numlock)
	{
		// don't map function keys to Apollo left keypad
		switch (code)
		{
		case 0x52: code = 0x75; break; // F1
		case 0x53: code = 0x76; break; // F2
		case 0x54: code = 0x77; break; // F3
		case 0x55: code = 0x78; break; // F4
		case 0x56: code = 0x79; break; // F5
		case 0x57: code = 0x7a; break; // F6
		case 0x58: code = 0x7b; break; // F7
		case 0x59: code = 0x7c; break; // F8
		case 0x5a: code = 0x7d; break; // F9
		case 0x5b: code = 0x74; break; // F0 = F10
		}
	}
#endif

	index = (code & 0x7f) * CODE_TABLE_ENTRY_SIZE;
	if (m_mode == KBD_MODE_0_COMPATIBILITY)
	{
		if (code & 0x80)
		{
			// skip up code in ASCII mode
		}
		else if (repeat > 0
				&& m_code_table[index + CODE_TABLE_AUTO_REPEAT_CODE] != Yes)
		{
			// skip repeat in ASCII mode
		}
		else if (ctrl)
		{
			key_code = m_code_table[index + CODE_TABLE_CONTROL_CODE];
		}
		else if (shift)
		{
			key_code = m_code_table[index + CODE_TABLE_SHIFTED_CODE];
		}
		else if (caps)
		{
			key_code = m_code_table[index + CODE_TABLE_CAPS_LOCK_CODE];
		}
		else
		{
			key_code = m_code_table[index + CODE_TABLE_UNSHIFTED_CODE];
		}
	}
	else
	{
		if (repeat > 0)
		{
			if (repeat == 1)
			{
				// auto repeat (but only for first scanned key)
				key_code = 0x7f;
			}
		}
		else if (code & 0x80)
		{
			key_code = m_code_table[index + CODE_TABLE_UP_CODE];
		}
		else
		{
			key_code = m_code_table[index + CODE_TABLE_DOWN_CODE];
		}
	}

	if (key_code != 0)
	{
		LOG2(("scan_code = 0x%02x key_code = 0x%04x",code, key_code));
		if (m_mode > KBD_MODE_1_KEYSTATE)
		{
			set_mode(KBD_MODE_1_KEYSTATE);
		}
//.........这里部分代码省略.........
开发者ID:DragonMinded,项目名称:mame,代码行数:101,代码来源:apollo_kbd.cpp


示例18: clkhandler

void	clkhandler()
{
	static uint32 count1000 = 1000;	/* variable to count 1000ms */

	volatile struct am335x_timer1ms *csrptr = 0x44E31000;
					/* Pointer to timer CSR	    */

	/* If there is no interrupt, return */

	if((csrptr->tisr & AM335X_TIMER1MS_TISR_OVF_IT_FLAG) == 0) {
		return;
	}

	LOG2(DEBUG_VERBOSE,DEBUG_SCHEDULER,
			"\nClkInt: a clock tick is being handled, ms was %d, secs were %d\n", 1000-count1000,clktime);

	/* Acknowledge the interrupt */

	csrptr->tisr = AM335X_TIMER1MS_TISR_OVF_IT_FLAG;

	/* Decrement 1000ms counter */

	count1000--;

	/* After 1 sec, increment clktime */

	if(count1000 == 0) {
		clktime++;
		count1000 = 1000;

		/* if EV_DTIMER env var is turned on then run the associated debugging output on a psuedo timer */
		if(envtab[EV_DTIMER].val && !(clktime%(envtab[EV_DTIMER].val))) {
			dtimer();
		}
	}

	/* if still NULL, update the pointer to the millisecond tracker so millisecond timestamps can be generated */
	if(!clktimems) {
		clktimems = &count1000;
	}

	/* check if sleep queue is empty */

	if(!isempty(sleepq)) {

		/* sleepq nonempty, decrement the key of */
		/* topmost process on sleepq		 */

		if((--queuetab[firstid(sleepq)].qkey) == 0) {

			wakeup();
		}
	}

	/* Decrement the preemption counter */
	/* Reschedule if necessary	    */

	if((--preempt) == 0) {
		LOG2(DEBUG_VERBOSE,DEBUG_SCHEDULER,"\nClkInt: preemption time \n");
		preempt = QUANTUM;
		resched();
	}
}
开发者ID:nwilder0,项目名称:bbb-xinu,代码行数:63,代码来源:clkhandler.c


示例19: cpu_loop_function

static void JNICALL
cpu_loop_function(jvmtiEnv *jvmti, JNIEnv *env, void *p)
{
    int         loop_trip_counter;
    jboolean    cpu_loop_running;

    loop_trip_counter          = 0;

    rawMonitorEnter(gdata->cpu_loop_lock); {
        gdata->cpu_loop_running = JNI_TRUE;
        cpu_loop_running = gdata->cpu_loop_running;
        /* Notify cpu_sample_init() that we have started */
        rawMonitorNotifyAll(gdata->cpu_loop_lock);
    } rawMonitorExit(gdata->cpu_loop_lock);

    rawMonitorEnter(gdata->cpu_sample_lock); /* Only waits inside loop let go */

    while ( cpu_loop_running ) {

        ++loop_trip_counter;

        LOG3("cpu_loop()", "iteration", loop_trip_counter);

        /* If a dump is in progress, we pause sampling. */
        rawMonitorEnter(gdata->dump_lock); {
            if (gdata->dump_in_process) {
                gdata->pause_cpu_sampling = JNI_TRUE;
            }
        } rawMonitorExit(gdata->dump_lock);

        /* Check to see if we need to pause sampling (listener_loop command) */
        if (gdata->pause_cpu_sampling) {

            /*
             * Pause sampling for now. Reset sample controls if
             * sampling is resumed again.
             */

            rawMonitorWait(gdata->cpu_sample_lock, 0);

            rawMonitorEnter(gdata->cpu_loop_lock); {
                cpu_loop_running = gdata->cpu_loop_running;
            } rawMonitorExit(gdata->cpu_loop_lock);

            /* Continue the while loop, which will terminate if done. */
            continue;
        }

        /* This is the normal short timed wait before getting a sample */
        rawMonitorWait(gdata->cpu_sample_lock,  (jlong)gdata->sample_interval);

        /* Make sure we really want to continue */
        rawMonitorEnter(gdata->cpu_loop_lock); {
            cpu_loop_running = gdata->cpu_loop_running;
        } rawMonitorExit(gdata->cpu_loop_lock);

        /* Break out if we are done */
        if ( !cpu_loop_running ) {
            break;
        }

        /*
         * If a dump request came in after we checked at the top of
         * the while loop, then we catch that fact here. We
         * don't want to perturb the data that is being dumped so
         * we just ignore the data from this sampling loop.
         */
        rawMonitorEnter(gdata->dump_lock); {
            if (gdata->dump_in_process) {
                gdata->pause_cpu_sampling = JNI_TRUE;
            }
        } rawMonitorExit(gdata->dump_lock);

        /* Sample all the threads and update trace costs */
        if ( !gdata->pause_cpu_sampling) {
            tls_sample_all_threads(env);
        }

        /* Check to see if we need to finish */
        rawMonitorEnter(gdata->cpu_loop_lock); {
            cpu_loop_running = gdata->cpu_loop_running;
        } rawMonitorExit(gdata->cpu_loop_lock);

    }
    rawMonitorExit(gdata->cpu_sample_lock);

    rawMonitorEnter(gdata->cpu_loop_lock); {
        /* Notify cpu_sample_term() that we are done. */
        rawMonitorNotifyAll(gdata->cpu_loop_lock);
    } rawMonitorExit(gdata->cpu_loop_lock);

    LOG2("cpu_loop()", "clean termination");
}
开发者ID:AllenWeb,项目名称:openjdk-1,代码行数:93,代码来源:hprof_cpu.c


示例20: ProcessRequest


//.........这里部分代码省略.........
                                    stateDescriptorLength,
                                    contents,
                                    &contentsDescriptor,
                                    1,
                                    PktTimeOut(autoFetches[i].clientSock))) {
              DROP_SOCKET(&autoFetches[i].clientSock);
              free(autoFetches[i].stateNames);
              autoFetches[i] = autoFetches[--autoFetchCount];
            }
          }
        }
      }
      free(contents);
    }
    break;

  case AUTOFETCH_BEGIN:
    stateNamesDescriptor.repetitions = dataSize;
    stateNames = (char *)malloc(dataSize);
    if(stateNames == NULL) {
      (void)SendMessage(*sd, MEMORY_FAILED, PktTimeOut(*sd));
      DROP_SOCKET(sd);
      ERROR("ProcessRequest: out of memory\n");
    }
    else if(!RecvData(*sd,
                      stateNames,
                      &stateNamesDescriptor,
                      1,
                      PktTimeOut(*sd))) {
      (void)SendMessage(*sd, MEMORY_FAILED, PktTimeOut(*sd));
      DROP_SOCKET(sd);
      free(stateNames);
      ERROR("ProcessRequest: data receive failed\n");
    }
    else if(*stateNames == '\0') {
      free(stateNames);
      EndAutoFetch(*sd);
      (void)SendMessage(*sd, AUTOFETCH_ACK, PktTimeOut(*sd));
    }
    else {
      for(i=0; (i < autoFetchCount) && (autoFetches[i].clientSock != *sd); i++)
        ; /* Nothing more to do. */
      if(i == autoFetchCount) {
        expandedAutoFetches =
          REALLOC(autoFetches, (autoFetchCount + 1) * sizeof(AutoFetchInfo));
        if(expandedAutoFetches == NULL) {
          (void)SendMessage(*sd, MEMORY_FAILED, PktTimeOut(*sd));
          DROP_SOCKET(sd);
          ERROR("ProcessRequest: out of memory\n");
          break;
        }
        autoFetches = expandedAutoFetches;
        autoFetches[i].clientSock = *sd;
        autoFetchCount++;
      }
      else {
        free(autoFetches[i].stateNames);
      }
      autoFetches[i].stateNames = stateNames;
      (void)SendMessage(*sd, AUTOFETCH_ACK, PktTimeOut(*sd));
    }
    break;

  case MEMORY_CLEAN:
    if(!RecvData(*sd, &expiration, &expirationDescriptor, 1, PktTimeOut(*sd))) {
      DROP_SOCKET(sd);
      ERROR("ProcessRequest: data receive failed\n");
    }
    else {
      (void)SendMessage(*sd, MEMORY_CLEANED, PktTimeOut(*sd));
      (void)DoClean(expiration);
    }
    break;

#ifdef WITH_NETLOGGER	  
  case MEMORY_LOGDEST: /* config message contains log location */
	  if(!RecvData(*sd,
		  &memLogLocation,
		  loglocationDescriptor,
		  loglocationDescriptorLength,
		  PktTimeOut(*sd))) {
		  DROP_SOCKET(sd);
		  ERROR("ProcessRequest: loglocation receive failed\n");
		  return;
	  }else
	  {
		  (void)SendMessage(*sd, MEMORY_LOGDEST_ACK, PktTimeOut(*sd));
	  }
	  LOG2("ProcessRequest: loglocation %d .%s.\n", memLogLocation.loc_type, memLogLocation.path);
 
	  break;
#endif /* WITH_NETLOGGER */	  	

  default:
    DROP_SOCKET(sd);
    ERROR1("ProcessRequest: unknown message %d\n", messageType);

  }

}
开发者ID:LogisticalComputingAndInternetworking,项目名称:LoRS,代码行数:101,代码来源:nws_memory.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOG3函数代码示例发布时间:2022-05-30
下一篇:
C++ LOG1函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap