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

C++ ARRAYLEN函数代码示例

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

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



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

示例1: plugin_start

enum plugin_status plugin_start(const void* parameter)
{
    int action, i;
    struct jackpot game;
    (void)parameter;
    rb->srand(*rb->current_tick);
#ifdef HAVE_LCD_CHARCELLS
    patterns_init(rb->screens[SCREEN_MAIN]);
#endif /* HAVE_LCD_CHARCELLS */
    jackpot_init(&game);

    FOR_NB_SCREENS(i){
        rb->screens[i]->clear_display();
        jackpot_display_slot_machine(&game, rb->screens[i]);
    }
    /*Empty the event queue*/
    rb->button_clear_queue();
    while (true)
    {
        action = pluginlib_getaction(TIMEOUT_BLOCK,
                                plugin_contexts, ARRAYLEN(plugin_contexts));
        switch ( action )
        {
            case PLA_CANCEL:
                return PLUGIN_OK;
            case PLA_SELECT:
                jackpot_play_turn(&game);
                break;

            default:
                if (rb->default_event_handler_ex(action, jackpot_exit, NULL)
                    == SYS_USB_CONNECTED)
                    return PLUGIN_USB_CONNECTED;
                break;
        }
    }
    jackpot_exit(NULL);
    return PLUGIN_OK;
}
开发者ID:eisnerd,项目名称:rockbox,代码行数:39,代码来源:jackpot.c


示例2: TEST

TEST(Utf8Utils, utf8IsValid) {
    static const struct {
        bool expected;
        const char* text;
        size_t textLen;
    } kData[] = {
        DATA(true, ""),
        DATA(true, "Hello World!"),
        DATA(true, "T\xC3\xA9l\xC3\xA9vision"),
        DATA(false, "\x80\x80"),
        DATA(true, "\xC1\xB6"),
        DATA(false, "\xC0\x7f"),
        DATA(true, "foo\xE0\x80\x80"),
        DATA(false, "foo\xE0\x80"),
    };
    const size_t kDataSize = ARRAYLEN(kData);
    for (size_t n = 0; n < kDataSize; ++n) {
        EXPECT_EQ(kData[n].expected,
                  utf8IsValid(kData[n].text,
                              kData[n].textLen)) << "#" << n;
    }
}
开发者ID:Dorahe,项目名称:platform_external_qemu,代码行数:22,代码来源:Utf8Utils_unittest.cpp


示例3: popPage

mxArray* popPage()
{
   size_t M,N,maxMN;
   double retVal;
   mxArray* tmp;
   biEntry* cmdStruct = lookupEntry("PageList", vars, ARRAYLEN(vars));
   if (cmdStruct->var == NULL)
   {
      return cmdStruct->getter(cmdStruct);
   }
   else
   {
      retVal = mxGetScalar(cmdStruct->var);
      M = mxGetM(cmdStruct->var);
      N = mxGetN(cmdStruct->var);
      maxMN = M > N ? M : N;
      tmp = mxCreateDoubleMatrix(1, maxMN - 1, mxREAL);
      memcpy(mxGetPr(tmp), mxGetPr(cmdStruct->var) + 1, (maxMN - 1)*sizeof(double));
      cmdStruct->setter(cmdStruct, tmp);
      return mxCreateDoubleScalar(retVal);
   }
}
开发者ID:Steve3nto,项目名称:NoiseReductionProject,代码行数:22,代码来源:block_interface.c


示例4: settings_apply_skins

void settings_apply_skins(void)
{
    char buf[MAX_PATH];
    /* re-initialize the skin buffer before we start reloading skins */
    skin_buffer_init();
    enum screen_type screen = SCREEN_MAIN;
    unsigned int i;
#ifdef HAVE_LCD_BITMAP
    skin_backdrop_init();
    skin_font_init();
#endif
#if CONFIG_TUNER
    fms_skin_init();
#endif
    for (i=0; i<ARRAYLEN(skins); i++)
    {
#ifdef HAVE_REMOTE_LCD
        screen = skins[i].suffix[0] == 'r' ? SCREEN_REMOTE : SCREEN_MAIN;
#endif
        CHART2(">skin load ", skins[i].suffix);
        if (skins[i].setting[0] && skins[i].setting[0] != '-')
        {
            snprintf(buf, sizeof buf, WPS_DIR "/%s.%s",
                     skins[i].setting, skins[i].suffix);
            skins[i].loadfunc(screen, buf, true);
        }
        else
        {
            skins[i].loadfunc(screen, NULL, true);
        }
        CHART2("<skin load ", skins[i].suffix);
    }
    viewportmanager_theme_changed(THEME_STATUSBAR);
#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1
    FOR_NB_SCREENS(i)
        screens[i].backdrop_show(sb_get_backdrop(i));
#endif
}
开发者ID:eisnerd,项目名称:rockbox,代码行数:38,代码来源:theme_settings.c


示例5: mspClientProcess

void mspClientProcess(void)
{
    static uint8_t index = 0;

    bool busy = mspPorts[1].commandSenderFn != NULL;
    if (busy) {
        return;
    }
    commandToSend = commandsToSend[index];
    mspPorts[1].commandSenderFn = mspRequestFCSimpleCommandSender;

    index++;
    if (index >= ARRAYLEN(commandsToSend)) {
        index = 0;
    }


    //
    // handle timeout of received data.
    //
    uint32_t now = micros();
    mspClientStatus.timeoutOccured = (cmp32(now, mspClientStatus.lastReplyAt) >= MSP_CLIENT_TIMEOUT_INTERVAL);
}
开发者ID:180jacob,项目名称:cleanflight,代码行数:23,代码来源:msp_client_osd.c


示例6: ASSERT

/* Buffer a block of sound data for the given sound.  Return the number of
 * frames buffered, or a RageSoundReader return code. */
int RageSoundDriver::GetDataForSound( Sound &s )
{
	sound_block *p[2];
	unsigned psize[2];
	s.m_Buffer.get_write_pointers( p, psize );

	/* If we have no open buffer slot, we have a buffer overflow. */
	ASSERT( psize[0] > 0 );

	sound_block *pBlock = p[0];
	int size = ARRAYLEN(pBlock->m_Buffer)/channels;
	int iRet = s.m_pSound->GetDataToPlay( pBlock->m_Buffer, size, pBlock->m_iPosition, pBlock->m_FramesInBuffer );
	if( iRet > 0 )
	{
		pBlock->m_BufferNext = pBlock->m_Buffer;
		s.m_Buffer.advance_write_pointer( 1 );
	}

//	LOG->Trace( "incr fr wr %i (state %i) (%p)",
//		(int) pBlock->m_FramesInBuffer, s.m_State, s.m_pSound );

	return iRet;
}
开发者ID:AratnitY,项目名称:stepmania,代码行数:25,代码来源:RageSoundDriver_Generic_Software.cpp


示例7: dbg_hw_info_dma

bool dbg_hw_info_dma(void)
{
    lcd_setfont(FONT_SYSFIXED);
    
    while(1)
    {
        int button = get_action(CONTEXT_STD, HZ / 25);
        switch(button)
        {
            case ACTION_STD_NEXT:
            case ACTION_STD_PREV:
            case ACTION_STD_OK:
            case ACTION_STD_MENU:
                lcd_setfont(FONT_UI);
                return true;
            case ACTION_STD_CANCEL:
                lcd_setfont(FONT_UI);
                return false;
        }
        
        lcd_clear_display();

        lcd_putsf(0, 0, "S C name bar      apb ahb una");
        for(unsigned i = 0; i < ARRAYLEN(dbg_channels); i++)
        {
            struct imx233_dma_info_t info = imx233_dma_get_info(dbg_channels[i].chan, DMA_INFO_ALL);
            lcd_putsf(0, i + 1, "%c %c %4s %8x %3x %3x %3x",
                info.gated ? 'g' : info.freezed ? 'f' : ' ',
                !info.int_enabled ? '-' : info.int_error ? 'e' : info.int_cmdcomplt ? 'c' : ' ',
                dbg_channels[i].name, info.bar, info.apb_bytes, info.ahb_bytes,
                info.nr_unaligned);
        }
        
        lcd_update();
        yield();
    }
}
开发者ID:4nykey,项目名称:rockbox,代码行数:37,代码来源:debug-imx233.c


示例8: ARRAYLEN

// 移動通知
void Movable::notify( int gen_ftype )
{
    KServer *sessions[MAX_CLIENT];
    int n = g_listener->GetChildren((vce::Session**)sessions, ARRAYLEN(sessions));
    for(int i=0;i<n;i++){
        PlayerCharacter *pc = sessions[i]->getPC();
        if(pc){
            // 同じフロアの近くにいるプレイヤーに伝える
            if( pc->floor != this->floor
                || pc->coord.distance( this->coord ) > NOTIFY_DISTANCE )continue;
        } else {
            // pcが無くても特別にwatchする状態だったら送る
            Coord c;
            vce::VUint32 flid;
            if( sessions[i]->isViewmode(&c, &flid ) == false ) continue;
            if( this->floor->id != flid
                || this->coord.distance( c ) > NOTIFY_DISTANCE )continue;
        }
        

        switch( gen_ftype ){
        case k_proto::FUNCTION_MOVENOTIFY:
            sessions[i]->send_moveNotify( this->id,
                                          this->typeID,
                                          this->name.c_str(),
                                          this->coord.x,
                                          this->coord.y,
                                          this->floor->id );

            break;
        case k_proto::FUNCTION_DISAPPEARNOTIFY:
            sessions[i]->send_disappearNotify( this->id );
            break;
        }
    }
}
开发者ID:Techie123,项目名称:book,代码行数:37,代码来源:movable.cpp


示例9:

const glyph &Font::GetGlyph( wchar_t c ) const
{
	//ASSERT(c >= 0 && c <= 0xFFFFFF);
	// shooting a blank really...DarkLink kept running into the stupid assert with non-roman song titles, 
	// and looking at it, I'm gonna guess that this is how ITG2 prevented crashing with them
	//  --infamouspat
	if (c < 0 || c > 0xFFFFFF)
		c = 1;

	/* Fast path: */
	if( c < (int) ARRAYLEN(m_iCharToGlyphCache) && m_iCharToGlyphCache[c] )
		return *m_iCharToGlyphCache[c];

	/* Try the regular character. */
	map<longchar,glyph*>::const_iterator it = m_iCharToGlyph.find(c);

	/* If that's missing, use the default glyph. */
	if(it == m_iCharToGlyph.end()) it = m_iCharToGlyph.find(DEFAULT_GLYPH);

	if(it == m_iCharToGlyph.end()) 
		RageException::Throw( "The default glyph is missing from the font '%s'", path.c_str() );
	
	return *it->second;
}
开发者ID:Braunson,项目名称:openitg,代码行数:24,代码来源:Font.cpp


示例10: clix_help

static bool clix_help(void)
{
    static char *help_text[] = {
        "Clix", "", "Aim", "",
        "Remove", "all", "blocks", "from", "the", "board", "to", "achieve",
        "the", "next", "level.", "You", "can", "only", "remove", "blocks,",
        "if", "at", "least", "two", "blocks", "with", "the", "same", "color",
        "have", "a", "direct", "connection.", "The", "more", "blocks", "you",
        "remove", "per", "turn,", "the", "more", "points", "you", "get."
    };
    static struct style_text formation[]={
        { 0, TEXT_CENTER|TEXT_UNDERLINE },
        { 2, C_RED },
        LAST_STYLE_ITEM
    };

    rb->lcd_setfont(FONT_UI);
    rb->lcd_set_foreground(LCD_WHITE);
    if (display_text(ARRAYLEN(help_text), help_text, formation, NULL, true))
        return true;
    rb->lcd_setfont(FONT_SYSFIXED);

    return false;
}
开发者ID:Brandon7357,项目名称:rockbox,代码行数:24,代码来源:clix.c


示例11: CmdHF15Demod

// Mode 3
//helptext
int CmdHF15Demod(const char *Cmd) {
	char cmdp = param_getchar(Cmd, 0);
	if (cmdp == 'h' || cmdp == 'H') return usage_15_demod();
	
	// The sampling rate is 106.353 ksps/s, for T = 18.8 us
	int i, j;
	int max = 0, maxPos = 0;
	int skip = 4;

	if (GraphTraceLen < 1000) return 0;

	// First, correlate for SOF
	for (i = 0; i < 1000; i++) {
		int corr = 0;
		for (j = 0; j < ARRAYLEN(FrameSOF); j += skip) {
			corr += FrameSOF[j] * GraphBuffer[i + (j / skip)];
		}
		if (corr > max) {
			max = corr;
			maxPos = i;
		}
	}

	PrintAndLogEx(NORMAL, "SOF at %d, correlation %d", maxPos, max / (ARRAYLEN(FrameSOF) / skip));
	
	i = maxPos + ARRAYLEN(FrameSOF) / skip;
	int k = 0;
	uint8_t outBuf[20];
	memset(outBuf, 0, sizeof(outBuf));
	uint8_t mask = 0x01;
	for (;;) {
		int corr0 = 0, corr1 = 0, corrEOF = 0;
		for (j = 0; j < ARRAYLEN(Logic0); j += skip) {
			corr0 += Logic0[j] * GraphBuffer[i + (j / skip)];
		}
		for (j = 0; j < ARRAYLEN(Logic1); j += skip) {
			corr1 += Logic1[j] * GraphBuffer[i + (j / skip)];
		}
		for (j = 0; j < ARRAYLEN(FrameEOF); j += skip) {
			corrEOF += FrameEOF[j] * GraphBuffer[i + (j / skip)];
		}
		// Even things out by the length of the target waveform.
		corr0 *= 4;
		corr1 *= 4;
		
		if (corrEOF > corr1 && corrEOF > corr0) {
			PrintAndLogEx(NORMAL, "EOF at %d", i);
			break;
		} else if (corr1 > corr0) {
			i += ARRAYLEN(Logic1) / skip;
			outBuf[k] |= mask;
		} else {
			i += ARRAYLEN(Logic0) / skip;
		}
		mask <<= 1;
		if (mask == 0) {
			k++;
			mask = 0x01;
		}
		if ((i + (int)ARRAYLEN(FrameEOF)) >= GraphTraceLen) {
			PrintAndLogEx(NORMAL, "ran off end!");
			break;
		}
	}
	
	if (mask != 0x01) {
		PrintAndLogEx(WARNING, "Error, uneven octet! (discard extra bits!)");
		PrintAndLogEx(NORMAL, "   mask = %02x", mask);
	}
	PrintAndLogEx(NORMAL, "%d octets", k);
	
	for (i = 0; i < k; i++)
		PrintAndLogEx(NORMAL, "# %2d: %02x ", i, outBuf[i]);

	PrintAndLogEx(NORMAL, "CRC %04x", Crc(outBuf, k - 2));
	return 0;
}
开发者ID:iceman1001,项目名称:proxmark3,代码行数:79,代码来源:cmdhf15.c


示例12: plugin_start

enum plugin_status plugin_start(const void* parameter)
{
    int button;
#ifdef MAZE_NEW_PRE
    int lastbutton = BUTTON_NONE;
#endif
    int quit = 0;
    struct maze maze;
    (void)parameter;

    /* Turn off backlight timeout */
    backlight_ignore_timeout();

    /* Seed the RNG */
    rb->srand(*rb->current_tick);

    FOR_NB_SCREENS(i)
        rb->screens[i]->set_viewport(NULL);

    /* Draw the background */
#if LCD_DEPTH > 1
    rb->lcd_set_backdrop(NULL);
#if LCD_DEPTH >= 16
    rb->lcd_set_foreground(LCD_RGBPACK( 0, 0, 0));
    rb->lcd_set_background(LCD_RGBPACK(182, 198, 229)); /* rockbox blue */
#elif LCD_DEPTH == 2
    rb->lcd_set_foreground(0);
    rb->lcd_set_background(LCD_DEFAULT_BG);
#endif
#endif

    /* Initialize and draw the maze */
    maze_init(&maze);
    maze_generate(&maze);
    FOR_NB_SCREENS(i)
        maze_draw(&maze, rb->screens[i]);

    while(!quit) {
#ifdef __PLUGINLIB_ACTIONS_H__
        button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts,
                ARRAYLEN(plugin_contexts));
#else
        button = rb->button_get(true);
#endif
        switch(button) {
        case MAZE_NEW:
#ifdef MAZE_NEW_PRE
            if(lastbutton != MAZE_NEW_PRE)
                break;
#endif
            maze_init(&maze);
            maze_generate(&maze);
            FOR_NB_SCREENS(i)
                maze_draw(&maze, rb->screens[i]);
            break;
        case MAZE_SOLVE:
            maze_solve(&maze);
            FOR_NB_SCREENS(i)
                maze_draw(&maze, rb->screens[i]);
            break;
        case MAZE_UP:
        case MAZE_UP_REPEAT:
            maze_move_player_up(&maze);
            FOR_NB_SCREENS(i)
                maze_draw(&maze, rb->screens[i]);
            break;
        case MAZE_RIGHT:
        case MAZE_RIGHT_REPEAT:
            maze_move_player_right(&maze);
            FOR_NB_SCREENS(i)
                maze_draw(&maze, rb->screens[i]);
            break;
        case MAZE_DOWN:
        case MAZE_DOWN_REPEAT:
            maze_move_player_down(&maze);
            FOR_NB_SCREENS(i)
                maze_draw(&maze, rb->screens[i]);
            break;
        case MAZE_LEFT:
        case MAZE_LEFT_REPEAT:
            maze_move_player_left(&maze);
            FOR_NB_SCREENS(i)
                maze_draw(&maze, rb->screens[i]);
            break;
        case MAZE_QUIT:
            /* quit plugin */
            quit=1;
            break;
        default:
            if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
                /* quit plugin */
                quit=2;
            }
            break;
        }
#ifdef MAZE_NEW_PRE
        if( button != BUTTON_NONE )
            lastbutton = button;
#endif
    }
//.........这里部分代码省略.........
开发者ID:victor2002,项目名称:rockbox_victor_clipplus,代码行数:101,代码来源:maze.c


示例13: ARRAYLEN

#include "global.h"
#include "io/G15.h"
#include "RageLog.h"
#include "RageUtil.h"

#include "arch/USB/USBDriver_Impl.h"

const unsigned short G15_VENDOR_ID = 0x046D;
const unsigned short G15_PRODUCT_ID[] = { 0xC227, 0xC251 };

const unsigned NUM_PRODUCT_IDS = ARRAYLEN( G15_PRODUCT_ID );

/* 10 ms */
const unsigned REQ_TIMEOUT = 10000;

void PixmapToLCDData( const unsigned char *pData, unsigned char *pLCD )
{
	ASSERT(pLCD);
	ASSERT(pData);

	memset(pLCD, 0, 992);
	pLCD[0] = 0x03;

	// ?_?
	for( unsigned row = 0; row < 43; row++ )
	{
		for( unsigned col = 0; col < 160; col++ )
		{
			if ( pData[row*160+col] == 0x01 )
			{
				pLCD[(row/8)*160 + col + 32] |= 1 << (row%8);
开发者ID:BitMax,项目名称:openitg,代码行数:31,代码来源:G15.cpp


示例14: CMainParams

    CMainParams() {
        strNetworkID = "main";
        consensus.nSubsidyHalvingInterval = 210000;
        consensus.BIP34Height = 227931;
        consensus.BIP34Hash = uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8");
        consensus.BIP65Height = 388381; // 000000000000000004c2b624ed5d7756c508d90fd0da2c7c679febfa6c4735f0
        consensus.BIP66Height = 363725; // 00000000000000000379eaa19dce8c9b722d46ae6a57c2f1a988119488b50931
        consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
        consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
        consensus.nPowTargetSpacing = 10 * 60;
        consensus.fPowAllowMinDifficultyBlocks = false;
        consensus.fPowNoRetargeting = false;
        consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016
        consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008

        // Deployment of BIP68, BIP112, and BIP113.
        consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
        consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1462060800; // May 1st, 2016
        consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1493596800; // May 1st, 2017

        // Deployment of SegWit (BIP141, BIP143, and BIP147)
        consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
        consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1479168000; // November 15th, 2016.
        consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1510704000; // November 15th, 2017.

        // The best chain should have at least this much work.
        consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000002cb971dd56d1c583c20f90");

        // By default assume that the signatures in ancestors of this block are valid.
        consensus.defaultAssumeValid = uint256S("0x0000000000000000030abc968e1bd635736e880b946085c93152969b9a81a6e2"); //447235

        /**
         * The message start string is designed to be unlikely to occur in normal data.
         * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
         * a large 32-bit integer with any alignment.
         */
        pchMessageStart[0] = 0xf9;
        pchMessageStart[1] = 0xbe;
        pchMessageStart[2] = 0xb4;
        pchMessageStart[3] = 0xd9;
        nDefaultPort = 8333;
        nPruneAfterHeight = 100000;

        genesis = CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN);
        consensus.hashGenesisBlock = genesis.GetHash();
        assert(consensus.hashGenesisBlock == uint256S("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"));
        assert(genesis.hashMerkleRoot == uint256S("0x4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"));

        // Note that of those with the service bits flag, most only support a subset of possible options
        vSeeds.push_back(CDNSSeedData("bitcoin.sipa.be", "seed.bitcoin.sipa.be", true)); // Pieter Wuille, only supports x1, x5, x9, and xd
        vSeeds.push_back(CDNSSeedData("bluematt.me", "dnsseed.bluematt.me", true)); // Matt Corallo, only supports x9
        vSeeds.push_back(CDNSSeedData("dashjr.org", "dnsseed.bitcoin.dashjr.org")); // Luke Dashjr
        vSeeds.push_back(CDNSSeedData("bitcoinstats.com", "seed.bitcoinstats.com", true)); // Christian Decker, supports x1 - xf
        vSeeds.push_back(CDNSSeedData("bitcoin.jonasschnelli.ch", "seed.bitcoin.jonasschnelli.ch", true)); // Jonas Schnelli, only supports x1, x5, x9, and xd

        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,128);
        base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x88)(0xB2)(0x1E).convert_to_container<std::vector<unsigned char> >();
        base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x88)(0xAD)(0xE4).convert_to_container<std::vector<unsigned char> >();

        vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));

        fMiningRequiresPeers = true;
        fDefaultConsistencyChecks = false;
        fRequireStandard = true;
        fMineBlocksOnDemand = false;

        checkpointData = (CCheckpointData) {
            boost::assign::map_list_of
            ( 11111, uint256S("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
            ( 33333, uint256S("0x000000002dd5588a74784eaa7ab0507a18ad16a236e7b1ce69f00d7ddfb5d0a6"))
            ( 74000, uint256S("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20"))
            (105000, uint256S("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97"))
            (134444, uint256S("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"))
            (168000, uint256S("0x000000000000099e61ea72015e79632f216fe6cb33d7899acb35b75c8303b763"))
            (193000, uint256S("0x000000000000059f452a5f7340de6682a977387c17010ff6e6c3bd83ca8b1317"))
            (210000, uint256S("0x000000000000048b95347e83192f69cf0366076336c639f9b7228e9ba171342e"))
            (216116, uint256S("0x00000000000001b4f4b433e81ee46494af945cf96014816a4e2370f11b23df4e"))
            (225430, uint256S("0x00000000000001c108384350f74090433e7fcf79a606b8e797f065b130575932"))
            (250000, uint256S("0x000000000000003887df1f29024b06fc2200b55f8af8f35453d7be294df2d214"))
            (279000, uint256S("0x0000000000000001ae8c72a0b0c301f67e3afca10e819efa9041e458e9bd7e40"))
            (295000, uint256S("0x00000000000000004d9b4ef50f0f9d686fd69db2e03af35a100370c64632a983"))
        };

        chainTxData = ChainTxData{
            // Data as of block 00000000000000000166d612d5595e2b1cd88d71d695fc580af64d8da8658c23 (height 446482).
            1483472411, // * UNIX timestamp of last known number of transactions
            184495391,  // * total number of transactions between genesis and that timestamp
                        //   (the tx=... number in the SetBestChain debug.log lines)
            3.2         // * estimated number of transactions per second after that timestamp
        };
    }
开发者ID:sipa,项目名称:bitcoin,代码行数:96,代码来源:chainparams.cpp


示例15: RegisterMiscRPCCommands

void RegisterMiscRPCCommands(CRPCTable &t)
{
    for (unsigned int vcidx = 0; vcidx < ARRAYLEN(commands); vcidx++)
        t.appendCommand(commands[vcidx].name, &commands[vcidx]);
}
开发者ID:Chovanec,项目名称:bitcoin,代码行数:5,代码来源:misc.cpp


示例16: CMainParams

    CMainParams() {
        // The message start string is designed to be unlikely to occur in normal data.
        pchMessageStart[0] = 0xb6;
        pchMessageStart[1] = 0xb6;
        pchMessageStart[2] = 0xb6;
        pchMessageStart[3] = 0xb6;
        nDefaultPort = 48327;
        nRPCPort = 48328;
        bnProofOfWorkLimit = CBigNum(~uint256(0) >> 20);
        nSubsidyHalvingInterval = 100000;

        // Build the genesis block. Note that the output of the genesis coinbase cannot
        // be spent as it did not originally exist in the database.
  
        const char* pszTimestamp = "Nadecoin";
        CTransaction txNew;
        txNew.vin.resize(1);
        txNew.vout.resize(1);
        txNew.vin[0].scriptSig = CScript() << 486604799 << CBigNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
        txNew.vout[0].nValue = 1 * COIN;
        txNew.vout[0].scriptPubKey = CScript() << ParseHex("") << OP_CHECKSIG;
        genesis.vtx.push_back(txNew);
        genesis.hashPrevBlock = 0;
        genesis.hashMerkleRoot = genesis.BuildMerkleTree();
        genesis.nVersion = 1;
        genesis.nTime    = 1300000000;
        genesis.nBits    = 0x1e0fffff;
        genesis.nNonce   = 0;
        
        //// debug print
        hashGenesisBlock = genesis.GetHash();
        //while (hashGenesisBlock > bnProofOfWorkLimit.getuint256()){
        //    if (++genesis.nNonce==0) break;
        //    hashGenesisBlock = genesis.GetHash();
        //}

        printf("%s\n", hashGenesisBlock.ToString().c_str());
        printf("%s\n", genesis.hashMerkleRoot.ToString().c_str());
        printf("%x\n", bnProofOfWorkLimit.GetCompact());
        genesis.print();
        
        
        assert(hashGenesisBlock == uint256("0x5c85b50a51b3437abdf0ed22d984278d4f95e60650966ecc179e84d7d1a1a271"));
        assert(genesis.hashMerkleRoot == uint256("0xc3ab53bcf6c4174ab22abec6923320e6f2af142fc3ec9c6c6f36065db7d02940"));

        vSeeds.push_back(CDNSSeedData("google.org", "google.org"));


        base58Prefixes[PUBKEY_ADDRESS] = 36;
        base58Prefixes[SCRIPT_ADDRESS] = 30;
        base58Prefixes[SECRET_KEY] = 224;

        // Convert the pnSeeds array into usable address objects.
        for (unsigned int i = 0; i < ARRAYLEN(pnSeed); i++)
        {
            // It'll only connect to one or two seed nodes because once it connects,
            // it'll get a pile of addresses with newer timestamps.
            // Seed nodes are given a random 'last seen time' 
            const int64 nTwoDays = 2 * 24 * 60 * 60;
            struct in_addr ip;
            memcpy(&ip, &pnSeed[i], sizeof(ip));
            CAddress addr(CService(ip, GetDefaultPort()));
            addr.nTime = GetTime() - GetRand(nTwoDays) - nTwoDays;
            vFixedSeeds.push_back(addr);
        }
    }
开发者ID:excellentsloth,项目名称:Nadecoin,代码行数:66,代码来源:chainparams.cpp


示例17: StopREST

void StopREST()
{
    for (unsigned int i = 0; i < ARRAYLEN(uri_prefixes); i++)
        UnregisterHTTPHandler(uri_prefixes[i].prefix, false);
}
开发者ID:Airche,项目名称:wificoin,代码行数:5,代码来源:rest.cpp


示例18: main

int main() {
 
    int i, j;
    char* value;
    size_t valueSize;
    cl_uint platformCount = 0;
    cl_platform_id* platforms;
    cl_uint deviceCount;
    cl_device_id* devices;
    cl_uint maxComputeUnits;
 
    // get all platforms
    if (clGetPlatformIDs(0, NULL, &platformCount) != CL_SUCCESS) {
        printf("Unable to get platform IDs\n");
        exit(1);
    }
    platforms = (cl_platform_id*) malloc(sizeof(cl_platform_id) * platformCount);
    if (clGetPlatformIDs(platformCount, platforms, NULL) != CL_SUCCESS) {
        printf("Unable to get platform IDs\n");
        exit(1);
    }
 
    for (i = 0; i < platformCount; i++) {
        printf("%i. Platform\n", i+1);

        char data[1024];
        size_t retsize;
        for (int j=0; j<ARRAYLEN(platform_data_items); ++j) {
            if (clGetPlatformInfo(platforms[i], platform_data_items[j].id, sizeof(data), data, &retsize) != CL_SUCCESS || retsize == sizeof(data)) {
                printf("Unable to get platform %s\n", platform_data_items[j].name);
                continue;
            }
            printf("  %s: %s\n", platform_data_items[j].name, data);
        }
 
        // get all devices
        if (clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, 0, NULL, &deviceCount) != CL_SUCCESS) {
            printf("Unable to get device IDs for platform %p\n", platforms[i]);
            continue;
        }
        devices = (cl_device_id*) malloc(sizeof(cl_device_id) * deviceCount);
        if (clGetDeviceIDs(platforms[i], CL_DEVICE_TYPE_ALL, deviceCount, devices, NULL) != CL_SUCCESS) {
            printf("Unable to get device IDs for platform %p\n", platforms[i]);
            continue;
        }
 
        // for each device print critical attributes
        for (j = 0; j < deviceCount; j++) {
 
            // print device name
            clGetDeviceInfo(devices[j], CL_DEVICE_NAME, 0, NULL, &valueSize);
            value = (char*) malloc(valueSize);
            clGetDeviceInfo(devices[j], CL_DEVICE_NAME, valueSize, value, NULL);
            printf("%d. Device: %s\n", j+1, value);
            free(value);
 
            // print hardware device version
            clGetDeviceInfo(devices[j], CL_DEVICE_VERSION, 0, NULL, &valueSize);
            value = (char*) malloc(valueSize);
            clGetDeviceInfo(devices[j], CL_DEVICE_VERSION, valueSize, value, NULL);
            printf(" %d.%d Hardware version: %s\n", j+1, 1, value);
            free(value);
 
            // print software driver version
            clGetDeviceInfo(devices[j], CL_DRIVER_VERSION, 0, NULL, &valueSize);
            value = (char*) malloc(valueSize);
            clGetDeviceInfo(devices[j], CL_DRIVER_VERSION, valueSize, value, NULL);
            printf(" %d.%d Software version: %s\n", j+1, 2, value);
            free(value);
 
            // print c version supported by compiler for device
            clGetDeviceInfo(devices[j], CL_DEVICE_OPENCL_C_VERSION, 0, NULL, &valueSize);
            value = (char*) malloc(valueSize);
            clGetDeviceInfo(devices[j], CL_DEVICE_OPENCL_C_VERSION, valueSize, value, NULL);
            printf(" %d.%d OpenCL C version: %s\n", j+1, 3, value);
            free(value);
 
            // print parallel compute units
            clGetDeviceInfo(devices[j], CL_DEVICE_MAX_COMPUTE_UNITS,
                    sizeof(maxComputeUnits), &maxComputeUnits, NULL);
            printf(" %d.%d Parallel compute units: %d\n", j+1, 4, maxComputeUnits);
 
        }
 
        free(devices);
 
    }
 
    free(platforms);
    return 0;
 
}
开发者ID:laanwj,项目名称:laanwj.github.io,代码行数:92,代码来源:devices.c


示例19: StartREST

bool StartREST()
{
    for (unsigned int i = 0; i < ARRAYLEN(uri_prefixes); i++)
        RegisterHTTPHandler(uri_prefixes[i].prefix, false, uri_prefixes[i].handler);
    return true;
}
开发者ID:Airche,项目名称:wificoin,代码行数:6,代码来源:rest.cpp


示例20: RunTests

bool RunTests( SoundReader *snd, const TestFile &tf )
{
	const char *fn = tf.fn;
	{
		float len = snd->GetLength();
//		printf("%f\n", len);
		if( len < 1000.0f )
		{
			LOG->Warn( "Test file %s is too short", fn );
			return false;
		}
	}

	/* Read the first second of the file.  Do this without calling any
	 * seek functions. */
	const int one_second_frames = snd->GetSampleRate();
	const int one_second=one_second_frames*sizeof(int16_t)*2;
	int16_t sdata[one_second_frames*2];
	char *data = (char *) sdata;
	memset( data, 0x42, one_second );
	ReadData( snd, -1, data, one_second );

	{
		/* Find out how many frames of silence we have. */
		int SilentFrames = FramesOfSilence( sdata, one_second_frames );
		
		const int16_t *InitialData = sdata + SilentFrames*2;
		const int InitialDataSize = one_second_frames - SilentFrames;

		if( InitialDataSize < (int) sizeof(tf.initial) )
		{
			LOG->Warn( "Not enough (%i<%i) data to check after %i frames of silence", InitialDataSize, sizeof(tf.initial), SilentFrames );
			return false;
		}
		
		bool Failed = false;
		if( SilentFrames != tf.SilentFrames  )
		{
			LOG->Trace( "Expected %i silence, got %i (%i too high)", tf.SilentFrames, SilentFrames, SilentFrames-tf.SilentFrames );
			Failed = true;
		}
		
		bool Identical = !memcmp( InitialData, tf.initial, sizeof(tf.initial) );
		if( !Identical )
		{
			LOG->Trace("Expected data:");
			dump( tf.initial, ARRAYLEN(tf.initial) );
			LOG->Trace(" ");
			Failed = true;
		}
			
		if( Failed )
		{
			LOG->Trace("Got data:");
			dump( InitialData, min( 16, 2*InitialDataSize ) );
		}

		const int LaterOffsetFrames = one_second_frames/2; /* half second */
		const int LaterOffsetSamples = LaterOffsetFrames * channels;
		const int16_t *LaterData = sdata + LaterOffsetSamples;
		Identical = !memcmp( LaterData, tf.later, sizeof(tf.later) );
		if( !Identical )
		{
			LOG->Trace("Expected half second data:");
                        dump( tf.later, ARRAYLEN(tf.later) );
			LOG->Trace("Got half second data:");
			dump( LaterData, 16 );
			Failed = true;

			/* See if we can find the half second data. */
			int16_t *p = (int16_t *) xmemsearch( sdata, one_second, tf.later, sizeof(tf.later), LaterOffsetSamples*sizeof(int16_t) );
			if( p )
			{
				int SamplesOff = p-sdata;
				int FramesOff = SamplesOff/2;
				LOG->Trace("Found half second data at frame %i (wanted %i), ahead by %i samples",
						FramesOff, LaterOffsetFrames, FramesOff-LaterOffsetFrames );
			}
//			else
//				dump( "foo", sdata, one_second/sizeof(int16_t) );

		}

		if( Failed )
			return false;
	}

	/* Make sure we're getting non-null data. */
	{
		bool all_null=true;
		bool all_42=true;

		for( int i = 0; i < one_second; ++i )
		{
			if( data[i] != 0 )
				all_null=false;
			if( data[i] != 0x42 )
				all_42=false;

		}
//.........这里部分代码省略.........
开发者ID:johntalbain28,项目名称:Stepmania-AMX,代码行数:101,代码来源:test_audio_readers.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ARRAYLENGTH函数代码示例发布时间:2022-05-30
下一篇:
C++ ARRAYCOUNT函数代码示例发布时间: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