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

C++ NELEMS函数代码示例

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

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



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

示例1: spiSend

void RFM70::setModeRX(void) {
	uint8_t val;

	// Flush RX FIFO
	spiSend(0, (uint8_t *) RFM70_cmd_flush_rx, NELEMS(RFM70_cmd_flush_rx));
	// Read Status
	val = readRegVal(RFM70_REG_STATUS);
	// Reset IRQ bits
	uint8_t data[] = {RFM70_CMD_WRITE_REG | RFM70_REG_STATUS, val};
	spiSend(0, data, 2);
	// RFM chip disable
	digitalWrite(_ce, LOW);
	// set PRIM_RX bit to 1
	val = readRegVal(RFM70_REG_CONFIG);
	val |= RFM70_PIN_PRIM_RX;
	data[0] = RFM70_CMD_WRITE_REG | RFM70_REG_CONFIG;
	data[1] = val;
	spiSend(0, data, 2);
	// RFM chip enable
	digitalWrite(_ce, HIGH);
}
开发者ID:chendong2012,项目名称:cells,代码行数:21,代码来源:rfm70.cpp


示例2: recv_stop

static void
recv_stop(Event_Type et, Object *obj, Any_Type reg_arg, Any_Type call_arg) {
    Call *c = (Call *) obj;
    int index;

    assert(et == EV_CALL_RECV_STOP && object_is_call(c));
    assert(c->basic.time_recv_start > 0);

    basic.call_xfer_sum += timer_now() - c->basic.time_recv_start;

    basic.hdr_bytes_received += c->reply.header_bytes;
    basic.reply_bytes_received += c->reply.content_bytes;
    basic.footer_bytes_received += c->reply.footer_bytes;

    index = (c->reply.status / 100);
    assert((unsigned) index < NELEMS(basic.num_replies));
    ++basic.num_replies[index];
    ++num_replies;

    ++c->conn->basic.num_calls_completed;
}
开发者ID:codeb2cc,项目名称:httperf,代码行数:21,代码来源:basic.c


示例3: Atom_free

void Atom_free(const char *str)
{
	unsigned long h;
	unsigned long hash_number;
	struct atom *p;
	struct atom *c;
	int Len;

	assert(str);

	Len = strlen(str);

	//Cercare atomo con la stringa
	hash_number = Atom_CalculateHash(str, Len);
	h = hash_number % NELEMS(buckets);
#ifdef DEBUG
	fprintf(stderr, "Hash number for string %s => %ld\n", str, hash_number);
	fprintf(stderr, "Hash value for string %s => %ld\n", str, h);
#endif

	c = buckets[h];
	p = NULL;
	/* Se due stringhe hanno un hash_number uguale, significa che corrispondono
	 * */
	while( c && (hash_number != c->hash_number) )
	{
		p = c;
		c = c->link;
	}

	if( p == NULL )
	{
		buckets[h] = c->link;
	}
	else
	{
		p->link = c->link;
	}
    FREE(c);
}
开发者ID:jubstuff,项目名称:LASD,代码行数:40,代码来源:atom_hash.c


示例4: set_debug_level

static void
set_debug_level(void)
{
    char *ccspDbg;
    int i;
    struct {
        char *name;
        int level;
    } levelTab[] = {
        {"debug",       CCSP_TRACE_LEVEL_DEBUG, },
        {"info",        CCSP_TRACE_LEVEL_INFO, },
        {"notice",      CCSP_TRACE_LEVEL_NOTICE, },
        {"warning",     CCSP_TRACE_LEVEL_WARNING, },
        {"error",       CCSP_TRACE_LEVEL_ERROR, },
        {"critical",    CCSP_TRACE_LEVEL_CRITICAL, },
        {"alert",       CCSP_TRACE_LEVEL_ALERT, },
        {"emergency",   CCSP_TRACE_LEVEL_EMERGENCY, },
    };

            pComponentName = "CCSP_SNMNP_Plugin";

    ccspDbg = getenv("CCSPDBG");
    if (!ccspDbg)
        return;

    for (i = 0; i < NELEMS(levelTab); i++)
    {
        if (AnscEqualString(ccspDbg, levelTab[i].name, TRUE))
        {
            AnscSetTraceLevel(levelTab[i].level);
            //pComponentName = "CCSP_SNMNP_Plugin";

            AnscTraceWarning(("setting debug level to \"%s\"\n", levelTab[i].name));
            break;
        }
    }

    return;
}
开发者ID:rdkcmf,项目名称:rdkb-CcspSnmpPa,代码行数:39,代码来源:CcspSnmpPlugin.c


示例5: OnUnhandledException

	LONG WINAPI OnUnhandledException(PEXCEPTION_POINTERS pExceptionInfo)
	{
		if (!bPassOn) // exception occurred while closing, force kill the server
			ExitProcess(1);

		bPassOn = false;

		MINIDUMP_EXCEPTION_INFORMATION ei;
		ei.ExceptionPointers = pExceptionInfo;
		ei.ThreadId = GetCurrentThreadId();
		ei.ClientPointers = FALSE;

		DWORD dwProcessId = GetCurrentProcessId();
		SYSTEMTIME stLocalTime;
		GetLocalTime(&stLocalTime);
		wchar_t CrashDumpW[1024];
		swprintf_s(CrashDumpW, NELEMS(CrashDumpW), 
				L"%s\\%s-%s-%s-%04X-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp", 
				g_CrashDirectory.c_str(), L"Phasor", PHASOR_HALO_BUILD,
				PHASOR_MAJOR_VERSION_STR, 
				PHASOR_INTERNAL_VERSION, stLocalTime.wYear, stLocalTime.wMonth,
				stLocalTime.wDay, stLocalTime.wHour, stLocalTime.wMinute, 
				stLocalTime.wSecond, dwProcessId, ei.ThreadId);

		HANDLE hFile = CreateFileW(CrashDumpW, GENERIC_READ | GENERIC_WRITE,
			NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

#ifdef BUILD_DEBUG
		MINIDUMP_TYPE dwDumpType = MiniDumpWithFullMemory;
#else
		MINIDUMP_TYPE dwDumpType = MiniDumpScanMemory;
#endif

		MiniDumpWriteDump(GetCurrentProcess(), dwProcessId, hFile, 
			dwDumpType, &ei, NULL, NULL);
		CloseHandle(hFile);

		return EXCEPTION_EXECUTE_HANDLER;
	}
开发者ID:ChadSki,项目名称:Phasor,代码行数:39,代码来源:CrashHandler.cpp


示例6: AllocateLightingPreviewtextures

void AllocateLightingPreviewtextures(void)
{
	static bool bHaveAllocated=false;
	if (! bHaveAllocated )
	{
		bHaveAllocated = true;
		MaterialSystemInterface()->BeginRenderTargetAllocation();
		for(int idx=0;idx<NELEMS(sg_ExtraFP16Targets);idx++)
			sg_ExtraFP16Targets[idx].Init(
				materials->CreateNamedRenderTargetTextureEx2(
					s_rt_names[idx],
					512, 512, RT_SIZE_DEFAULT, s_rt_formats[idx],
					MATERIAL_RT_DEPTH_SHARED, 
					TEXTUREFLAGS_CLAMPS | TEXTUREFLAGS_CLAMPT,
					CREATERENDERTARGETFLAGS_HDR )
				);
		
		// End block in which all render targets should be allocated (kicking off an Alt-Tab type
		// behavior)
		MaterialSystemInterface()->EndRenderTargetAllocation();
	}
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:22,代码来源:material.cpp


示例7: MarineProfileList

void CASW_Briefing::AutoSelectFullSquadForSingleplayer( int nFirstSelectedProfileIndex )
{
	if ( !MarineProfileList() )
		return;

	CASW_Marine_Profile* pFirstSelectedProfile = MarineProfileList()->GetProfile( nFirstSelectedProfileIndex );
	if ( !pFirstSelectedProfile )
		return;

	ASW_Marine_Class nMarineClasses[]=
	{
		MARINE_CLASS_NCO, 
		MARINE_CLASS_SPECIAL_WEAPONS,
		MARINE_CLASS_MEDIC,
		MARINE_CLASS_TECH
	};

	// select one of each class
	for ( int i = 0; i < NELEMS( nMarineClasses ); i++ )
	{
		if ( nMarineClasses[ i ] == pFirstSelectedProfile->GetMarineClass() )
			continue;

		CASW_Marine_Profile* pProfile = NULL;
		for ( int p = 0; p < MarineProfileList()->m_NumProfiles; p++ )
		{
			pProfile = MarineProfileList()->GetProfile( p );
			if ( pProfile && pProfile->GetMarineClass() == nMarineClasses[i] )
			{
				break;
			}
		}

		if ( !pProfile )
			continue;

		SelectMarine( 0, pProfile->m_ProfileIndex, -1 );
	}
}
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:39,代码来源:asw_briefing.cpp


示例8: elf_x86_x86_map_reloc_info_to_type

static unsigned int
elf_x86_x86_map_reloc_info_to_type(elf_reloc_entry *reloc,
                                   yasm_symrec **ssyms)
{
    if (reloc->wrt) {
        size_t i;
        for (i=0; i<NELEMS(elf_x86_x86_ssyms); i++) {
            if (reloc->wrt == ssyms[i] &&
                reloc->valsize == elf_x86_x86_ssyms[i].size) {
                /* Force TLS type; this is required by the linker. */
                if (elf_x86_x86_ssyms[i].sym_rel & ELF_SSYM_THREAD_LOCAL) {
                    elf_symtab_entry *esym;

                    esym = yasm_symrec_get_data(reloc->reloc.sym,
                                                &elf_symrec_data);
                    if (esym)
                        esym->type = STT_TLS;
                }
                return (unsigned char) elf_x86_x86_ssyms[i].reloc;
            }
        }
        yasm_internal_error(N_("Unsupported WRT"));
    } else if (reloc->rtype_rel) {
        switch (reloc->valsize) {
            case 8: return (unsigned char) R_386_PC8;
            case 16: return (unsigned char) R_386_PC16;
            case 32: return (unsigned char) R_386_PC32;
            default: yasm_internal_error(N_("Unsupported relocation size"));
        }
    } else {
        switch (reloc->valsize) {
            case 8: return (unsigned char) R_386_8;
            case 16: return (unsigned char) R_386_16;
            case 32: return (unsigned char) R_386_32;
            default: yasm_internal_error(N_("Unsupported relocation size"));
        }
    }
    return 0;
}
开发者ID:Mirocow,项目名称:balancer,代码行数:39,代码来源:elf-x86-x86.c


示例9: test_rename

static error test_rename(atom_set_t *d)
{
  error err;
  int   i;

  printf("test: rename\n");

  for (i = 0; i < NELEMS(newnames); i++)
  {
    atom_t idx;

    printf("adding '%s'... ", data[i]);

    err = atom_new(d, (const unsigned char *) data[i],
                   strlen(data[i]) + 1, &idx);
    if (err && err != error_ATOM_NAME_EXISTS)
      return err;

    if (err == error_ATOM_NAME_EXISTS)
      printf("already exists ");

    printf("as %d\n", idx);

    printf("renaming index %d to '%s'... ", idx, newnames[i]);

    err = atom_set(d, idx, (const unsigned char *) newnames[i],
                   strlen(newnames[i]) + 1);
    if (err == error_ATOM_NAME_EXISTS)
      printf("already exists!");
    else if (err)
      return err;
    else
      printf("ok");

    printf("\n");
  }

  return error_OK;
}
开发者ID:dpt,项目名称:PrivateEye,代码行数:39,代码来源:test.c


示例10: uninstall_cfw

int uninstall_cfw(void)
{
	int ret;

	sceIoRemove("flash1:/config.se");

	int i; for(i=0; i<NELEMS(g_file_lists); ++i) {
		printf("Removing %s...", g_file_lists[i].dst);
		ret = sceIoRemove(g_file_lists[i].dst);

		if(ret == 0 || ret == 0x80010002) {
			printf("OK\n");
		} else {
			printf("failed(0x%08X)\n", ret);
		}
	}

	// per model uninstall goes here:
	switch(psp_model) {
		case PSP_GO:
			break;
		case PSP_4000:
			break;
		case PSP_3000:
			break;
		case PSP_2000:
			break;
		case PSP_1000:
			break;
	}

	if(is_permanent_patch_installed()) {
		printf("Uninstalling permanent patch...");
		uninstall_permanent_patch();
		printf("OK\n");
	}

	return 0;
}
开发者ID:AnnaKozlowska,项目名称:procfw,代码行数:39,代码来源:main.c


示例11: test_add_tags

static error test_add_tags(State *state)
{
  error err;
  int   i;

  for (i = 0; i < NELEMS(tagnames); i++)
  {
    printf("adding '%s'...", tagnames[i]);
    err = tagdb_add(state->db, tagnames[i], &state->tags[i]);
    if (err)
      goto Failure;

    printf("is tag %d\n", state->tags[i]);
  }

  return error_OK;


Failure:

  return err;
}
开发者ID:dpt,项目名称:PrivateEye,代码行数:22,代码来源:test.c


示例12: simulate_files

int simulate_files(int creat)
{
	size_t i;
	char *files[] =
	    { "config0.cfg", "config1.cfg", "config2.cfg", "config3.cfg",
		"rr109.img", "rx100.img", "rx107.img", "rm957.img", "messages"
	};

	for (i = 0; i < NELEMS(files); i++) {
		if (creat)
			touch(files[i]);
		else
			erase(files[i]);
	}

	if (creat)
		symlink("config2.cfg", STARTUP_CONFIG);
	else
		erase(STARTUP_CONFIG);

	return 0;
}
开发者ID:troglobit,项目名称:libite,代码行数:22,代码来源:dir.c


示例13: mrb_wslay_event_on_msg_recv_callback

static void
mrb_wslay_event_on_msg_recv_callback(wslay_event_context_ptr ctx,
  const struct wslay_event_on_msg_recv_arg *arg, void *user_data)
{
  mrb_wslay_user_data *data = (mrb_wslay_user_data *) user_data;
  mrb_state *mrb = data->mrb;

  int ai = mrb_gc_arena_save(mrb);
  struct mrb_jmpbuf *prev_jmp = mrb->jmp;
  struct mrb_jmpbuf c_jmp;

  MRB_TRY(&c_jmp) {
    mrb->jmp = &c_jmp;

    mrb_value argv[4];
    argv[0] = mrb_fixnum_value(arg->rsv);
    argv[1] = MRB_GET_OPCODE(mrb_fixnum_value(arg->opcode));
    argv[2] = mrb_str_new(mrb, (const char *) arg->msg, arg->msg_length);
    argv[3] = MRB_GET_STATUSCODE(mrb_fixnum_value(arg->status_code));

    mrb_value on_msg_recv_arg = mrb_obj_new(mrb,
      mrb_class_get_under(mrb,
        mrb_module_get_under(mrb,
          mrb_module_get(mrb, "Wslay"), "Event"), "OnMsgRecvArg"), NELEMS(argv), argv);

    mrb_assert(mrb_type(data->on_msg_recv_callback) == MRB_TT_PROC);
    mrb_yield(mrb, data->on_msg_recv_callback, on_msg_recv_arg);

    mrb_gc_arena_restore(mrb, ai);

    mrb->jmp = prev_jmp;
  } MRB_CATCH(&c_jmp) {
    mrb->jmp = prev_jmp;
    wslay_event_set_error(ctx, WSLAY_ERR_CALLBACK_FAILURE);
    mrb_gc_arena_restore(mrb, ai);
    MRB_THROW(mrb->jmp);
  } MRB_END_EXC(&c_jmp);
}
开发者ID:Asmod4n,项目名称:mruby-wslay,代码行数:38,代码来源:mrb_wslay.c


示例14: readAccelerometer

String Accelerometer::processor() {
  String output;
  for (int axis=0; axis<3; axis++) {
    average_delta_a[axis]  = 0;
  }
  
  for (int i=0; i<iterations; i++) {
    readAccelerometer();
    for (int axis=0; axis<3; axis++) {
      //delta_a[axis][i]=current_acceleration[axis] - previous_acceleration[axis];
      //average_delta_a[axis] += delta_a[axis][i];
      average_delta_a[axis] += current_acceleration[axis] - previous_acceleration[axis];
    }
    delay(delta);
  }

  for (int axis=0; axis<3; axis++) {
    average_delta_a[axis] = average_delta_a[axis] / iterations;
    
    if (abs(average_delta_a[axis]) > mThreshold
      && (millis() - previous_event_time[axis]) > mEventThreshold) {
      if (previous_event[axis] > 0 && average_delta_a[axis] < 0) { // turning point
        output = axes[axis][0];
      } else if (previous_event[axis] < 0 && average_delta_a[axis] > 0) { // turning point 
        output = axes[axis][1];
      }
      previous_event_time[axis] = millis(); // update last event
      previous_event[axis] = average_delta_a[axis]; // store this last acceleration value
    }
    
  }
  
  // store previous acceleration
  for (int i=0; i<NELEMS(current_acceleration); i++) {
    previous_acceleration[i] = current_acceleration[i];
  }
  return output;
}
开发者ID:DecodedCo,项目名称:accelerometer-library,代码行数:38,代码来源:Accelerometer.cpp


示例15: test_enumerate_ids_by_tags

static error test_enumerate_ids_by_tags(State *state)
{
  error err;
  int   cont;
  char  buf[256];

  {
    static const tagdb_tag want[] = { 0, 1 };

    printf("ids tagged with '%s' and '%s'...\n",
           tagnames[want[0]], tagnames[want[1]]);

    cont = 0;
    do
    {
      err = tagdb_enumerate_ids_by_tags(state->db, want, NELEMS(want),
                                              &cont, buf, sizeof(buf));
      if (err)
        goto Failure;

      if (cont)
      {
        printf("- ");
        printdigest(buf);
        printf("\n");
      }
    }
    while (cont);
  }

  return error_OK;


Failure:

  return err;
}
开发者ID:dpt,项目名称:PrivateEye,代码行数:37,代码来源:test.c


示例16: preferences_save_media

void preferences_save_media(int fd)
{
 Wire w;
 int i, n;
 char *medium_defs="MEDIUM_DEFINITIONS";

  DBG(DBG_proc, "preferences_save_media\n");

  w.io.fd = fd;
  w.io.read = read;
  w.io.write = write;
  xsane_rc_io_w_init(&w);
  xsane_rc_io_w_set_dir(&w, WIRE_ENCODE);

  xsane_rc_io_w_string(&w, &medium_defs);
  xsane_rc_io_w_word(&w, &preferences.medium_definitions);

  /* save media */

  n=0;

  DBG(DBG_info, "saving %d medium definitions\n", preferences.medium_definitions);

  while (n < preferences.medium_definitions)
  {
    DBG(DBG_info2, "=> saving medium definition %s\n", preferences.medium[n]->name);
    for (i = 0; i < NELEMS(desc_medium); ++i)
    {
      xsane_rc_io_w_string(&w, &desc_medium[i].name);
      (*desc_medium[i].codec) (&w, preferences.medium[n], desc_medium[i].offset);
    }
    n++;
  }

  xsane_rc_io_w_set_dir(&w, WIRE_DECODE);	/* flush it out */
  xsane_rc_io_w_exit(&w);
}
开发者ID:connormai,项目名称:xsane,代码行数:37,代码来源:xsane-preferences.c


示例17: emitasm

static unsigned emitasm(Node p, int nt) {
	int rulenum;
	short *nts;
	char *fmt;
	Node kids[10];

	p = reuse(p, nt);
	rulenum = getrule(p, nt);
	nts = IR->x._nts[rulenum];
	fmt = IR->x._templates[rulenum];
	assert(fmt);
	if (IR->x._isinstruction[rulenum] && p->x.emitted)
		print("%s", p->syms[RX]->x.name);
	else if (*fmt == '#')
		(*IR->x.emit2)(p);
	else {
		if (*fmt == '?') {
			fmt++;
			assert(p->kids[0]);
			if (p->syms[RX] == p->x.kids[0]->syms[RX])
				while (*fmt++ != '\n')
					;
		}
		for ((*IR->x._kids)(p, rulenum, kids); *fmt; fmt++)
			if (*fmt != '%')
				(void)putchar(*fmt);
			else if (*++fmt == 'F')
				print("%d", framesize);
			else if (*fmt >= '0' && *fmt <= '9')
				emitasm(kids[*fmt - '0'], nts[*fmt - '0']);
			else if (*fmt >= 'a' && *fmt < 'a' + NELEMS(p->syms))
				fputs(p->syms[*fmt - 'a']->x.name, stdout);
			else
				(void)putchar(*fmt);
	}
	return 0;
}
开发者ID:martijnvandijke,项目名称:Computation-2,代码行数:37,代码来源:gen.c


示例18: extract_db_exec_stat

static void *
extract_db_exec_stat (FILE * fp, const char *dbname, T_CM_ERROR * err_buf)
{
  unsigned int nitem = 0;
  char linebuf[LINE_MAX];
  char prop_name[100];
  T_CM_DB_EXEC_STAT *stat;
  stat = (T_CM_DB_EXEC_STAT *) calloc (1, sizeof (*stat));
  if (stat == NULL)
    {
      cm_set_error (err_buf, CM_OUT_OF_MEMORY);
      return NULL;
    }
  while (fgets (linebuf, sizeof (linebuf), fp))
    {
      unsigned int *member_ptr;
      unsigned int prop_val;
      memset (prop_name, 0, sizeof (prop_name));
      sscanf (linebuf, "%99s%*s%u", prop_name, &prop_val);
      member_ptr = get_statdump_member_ptr (stat, prop_name);
      if (!member_ptr)
	continue;
      *member_ptr = prop_val;
      nitem++;
    }
  if (nitem < NELEMS (statdump_offset))
    {
      err_buf->err_code = CM_READ_STATDUMP_INFO_ERROR;
      snprintf (err_buf->err_msg, sizeof (err_buf->err_msg) - 1,
		ER (err_buf->err_code), dbname);
      FREE_MEM (stat);
      return NULL;
    }

  return stat;

}
开发者ID:dong1,项目名称:testsize,代码行数:37,代码来源:cm_mem_cpu_stat.c


示例19: Q_strlen

// monitor output from our process to determine which part of the build we're in
void CASW_Map_Builder::UpdateProgress()
{
	// copy the new chars into our buffer
	int newcharslen = Q_strlen(m_szProcessBuffer);
	for (int i=0;i<newcharslen;i++)
	{
		m_szOutputBuffer[m_iOutputBufferPos++] = m_szProcessBuffer[i];
		// if we go over the end of our output buffer, then shift everything back by half the buffer and continue
		if (m_iOutputBufferPos >= MAP_BUILD_OUTPUT_BUFFER_SIZE)
		{
			for (int k=0;k<MAP_BUILD_OUTPUT_BUFFER_HALF_SIZE;k++)
			{
				m_szOutputBuffer[k] = m_szOutputBuffer[k + MAP_BUILD_OUTPUT_BUFFER_HALF_SIZE];
			}
			m_iOutputBufferPos = MAP_BUILD_OUTPUT_BUFFER_HALF_SIZE;
		}
	}

	// now scan our buffer for progress messages in reverse order
	int iNumSearch = NELEMS(s_szProgressTerms);
	for (int iSearch=iNumSearch-1;iSearch>m_iCurrentBuildSearch;iSearch--)
	{
		char *pos = Q_strstr(m_szOutputBuffer, s_szProgressTerms[iSearch]);
		if ( pos )
		{
			//Msg("Output (%s) matched (%s) result %s at %d\n", m_szOutputBuffer, s_szProgressTerms[iSearch], pos, pos - m_szOutputBuffer);
			m_iCurrentBuildSearch = iSearch;
			m_flProgress = float(iSearch) / float (iNumSearch);
			if (Q_strlen(s_szStatusLabels[iSearch]) > 0)
			{
				Q_snprintf( m_szStatusMessage, sizeof(m_szStatusMessage), "%s", s_szStatusLabels[iSearch] );

			}
			break;
		}
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:38,代码来源:asw_map_builder.cpp


示例20: NELEMS

char *stringn(char *str, int len)
{
    int i;
    unsigned int h;
    char *end;
    struct string *p;

    /* hash function */
    for (h = 0, i = len, end = str; i > 0; i--)
	h = (h<<1) + scatter[*(unsigned char *)end++];
    h &= NELEMS(buckets) - 1;

    for (p = buckets[h]; p; p = p->link)
	if (len == p->len) {
	    char *s1 = str, *s2 = p->str;
	    do {
		if (s1 == end)
		    return p->str;
	    } while (*s1++ == *s2++);
	}
    {
	static char *next, *strlimit;
	if (next + len + 1 >= strlimit) {
	    int n = len + 4*1024;
	    next = allocate(n, PERM);
	    strlimit = next + n;
	}
	NEW(p, PERM);
	p->len = len;
	for (p->str = next; str < end; )
	    *next++ = *str++;
	*next++ = 0;
	p->link = buckets[h];
	buckets[h] = p;
	return p->str;
    }
}
开发者ID:tinytinybird,项目名称:tinybirdcc,代码行数:37,代码来源:string.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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