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

C++ IN_RANGE函数代码示例

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

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



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

示例1: detectBoundaries

void Duck::detectBoundaries()
{
    //If we're outside the screen's x range...
    if (!IN_RANGE(sprite.GetPosition().x, buffer[LEFT], buffer[RIGHT])) {
        sprite.SetX(buffer[sprite.GetPosition().x < buffer[LEFT] ? LEFT : RIGHT]);
        velocity.x *= -1;
    }

    //If we're outside the screen's y range...
    if (state == DuckState::FLYING_AROUND) {  //The ducks ignore up and down boundaries if flying in or out
        float temp = SCREEN.GetHeight()*.6;
        if (!IN_RANGE(sprite.GetPosition().y, buffer[UP], temp)) {
            sprite.SetY(sprite.GetPosition().y < temp ? buffer[UP] : temp);
            velocity.y *= -1;
        }
    }
}
开发者ID:JesseTG,项目名称:Linear-Algebra-Demo,代码行数:17,代码来源:Duck.cpp


示例2: opengl_depth_buffer_set_pixel

void opengl_depth_buffer_set_pixel(struct opengl_depth_buffer_t *db, int x, int y, float depth_val)
{
	/* Invalid X coordinate */
	if (!IN_RANGE(x, 0, db->width - 1))
	{
		warning("%s: invalid X coordinate", __FUNCTION__);
		return;
	}

	/* Invalid Y coordinate */
	if (!IN_RANGE(y, 0, db->height - 1))
	{
		warning("%s: invalid Y coordinate", __FUNCTION__);
		return;
	}

	db->buffer[y * db->width + x] = depth_val;
}
开发者ID:3upperm2n,项目名称:gpuSimulators,代码行数:18,代码来源:si-db.c


示例3: ImageProcess_ColorMask

//REMEMBER BGR FORMAT
void OpenCVItemProcessing::ImageProcess_ColorMask(Mat image)
{
	image.forEach<Pixel>([](Pixel& pixel,const int* position)->void
	{
		if (IN_RANGE(pixel.z, r_min, r_max) && IN_RANGE(pixel.y, g_min, g_max) && IN_RANGE(pixel.x, b_min, b_max))
		{
			pixel.x = 255;
			pixel.y = 255;
			pixel.z = 255;
		}
		else
		{
			pixel.x = 0;
			pixel.y = 0;
			pixel.z = 0;
		}
	});
}
开发者ID:37Squad,项目名称:OpenCVExperiments,代码行数:19,代码来源:OpenCVItemProcessing.cpp


示例4: uri_parse_authority

static int uri_parse_authority(const char *authority, struct uri *uri) {
  const char *portsep;
  const char *host_start, *host_end;
  char *tail;

  /* We do not support "user:[email protected]" userinfo. The proxy has no use for it. */
  if (strchr(authority, '@') != NULL)
    return -1;

  /* Find the beginning and end of the host. */
  host_start = authority;

  if (*host_start == '[') {
    /* IPv6 address in brackets. */
    host_start++;
    host_end = strchr(host_start, ']');

    if (host_end == NULL)
      return -1;

    portsep = host_end + 1;

    if (!(*portsep == ':' || *portsep == '\0'))
      return -1;

  } else {
    portsep = strrchr(authority, ':');

    if (portsep == NULL)
      portsep = strchr(authority, '\0');
    host_end = portsep;
  }

  /* Get the port number. */
  if (*portsep == ':' && *(portsep + 1) != '\0') {
    long n;

    errno = 0;
    n = parse_long(portsep + 1, &tail);
    if (errno || *tail || (tail == (portsep + 1)) || !IN_RANGE(n, 1, 65535))
      return -1;
    uri->port = n;
  } else {
    uri->port = -1;
  }

  /* Get the host. */
  uri->host = mkstr(host_start, host_end);
  if (percent_decode(uri->host) < 0) {
    free(uri->host);
    uri->host = NULL;
    return -1;
  }

  return 1;
}
开发者ID:4nY0n0m0u5,项目名称:nmap,代码行数:56,代码来源:nsock_proxy.c


示例5: borderselect_gplayer_frames

/* select the frames in this layer that occur within the bounds specified */
void borderselect_gplayer_frames (bGPDlayer *gpl, float min, float max, short select_mode)
{
	bGPDframe *gpf;
	
	/* only select those frames which are in bounds */
	for (gpf= gpl->frames.first; gpf; gpf= gpf->next) {
		if (IN_RANGE(gpf->framenum, min, max))
			gpframe_select(gpf, select_mode);
	}
}
开发者ID:jinjoh,项目名称:NOOR,代码行数:11,代码来源:editaction_gpencil.c


示例6: if

void MenuStage::OnMouseButtonPress(uint32 x, uint32 y, bool left)
{
    if (IN_RANGE(x,y, WIDTH-350, WIDTH, 50, 50+80))
    {
        sApplication->SetStage(STAGE_GAMESETTINGS, 100);
        return;
    }
    else if (IN_RANGE(x,y, WIDTH-350, WIDTH, 160, 160+80))
    {
        sNetwork->Connect(sConfig->HostName.c_str(), sConfig->NetworkPort);
        sApplication->SetStage(STAGE_GAMESETTINGS);
        return;
    }
    else if (IN_RANGE(x,y, WIDTH-350, WIDTH, 270, 270+80))
    {
        exit(0);
        return;
    }
}
开发者ID:Ragzid,项目名称:BomberClient,代码行数:19,代码来源:MenuStage.cpp


示例7: PJ_DEF

/* Register strerror handle. */
PJ_DEF(pj_status_t) pj_register_strerror( pj_status_t start,
					  pj_status_t space,
					  pj_error_callback f)
{
    unsigned i;

    /* Check arguments. */
    PJ_ASSERT_RETURN(start && space && f, PJ_EINVAL);

    /* Check if there aren't too many handlers registered. */
    PJ_ASSERT_RETURN(err_msg_hnd_cnt < PJ_ARRAY_SIZE(err_msg_hnd),
		     PJ_ETOOMANY);

    /* Start error must be greater than PJ_ERRNO_START_USER */
    PJ_ASSERT_RETURN(start >= PJ_ERRNO_START_USER, PJ_EEXISTS);

    /* Check that no existing handler has covered the specified range. */
    for (i=0; i<err_msg_hnd_cnt; ++i) {
	if (IN_RANGE(start, err_msg_hnd[i].begin, err_msg_hnd[i].end) ||
	    IN_RANGE(start+space-1, err_msg_hnd[i].begin, err_msg_hnd[i].end))
	{
	    if (err_msg_hnd[i].begin == start && 
		err_msg_hnd[i].end == (start+space) &&
		err_msg_hnd[i].strerror == f)
	    {
		/* The same range and handler has already been registered */
		return PJ_SUCCESS;
	    }

	    return PJ_EEXISTS;
	}
    }

    /* Register the handler. */
    err_msg_hnd[err_msg_hnd_cnt].begin = start;
    err_msg_hnd[err_msg_hnd_cnt].end = start + space;
    err_msg_hnd[err_msg_hnd_cnt].strerror = f;

    ++err_msg_hnd_cnt;

    return PJ_SUCCESS;
}
开发者ID:carlosdelfino,项目名称:WorkshopTelefoniaAutomacao,代码行数:43,代码来源:errno.c


示例8: register_no_elim_operand_1

static inline int
register_no_elim_operand_1 (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
#line 513 "../.././gcc/config/i386/predicates.md"
{
  if (GET_CODE (op) == SUBREG)
    op = SUBREG_REG (op);
  return !(op == arg_pointer_rtx
	   || op == frame_pointer_rtx
	   || IN_RANGE (REGNO (op),
			FIRST_PSEUDO_REGISTER, LAST_VIRTUAL_REGISTER));
}
开发者ID:YoungLeeNENU,项目名称:My-Emacs-Configuration,代码行数:11,代码来源:insn-preds.c


示例9: mincore

/*
 * mincore -- interpose on libc mincore(2)
 *
 * Return 0 only for specified regions, otherwise return -1 with
 * errno = ENOMEM.
 */
int
mincore(void *addr, size_t length, unsigned char *vec)
{
	for (int i = 0; i < Nregions; i++) {
		if (IN_RANGE(addr, length, Mincore[i].addr, Mincore[i].len))
			return 0;
	}

	errno = ENOMEM;
	return -1;
}
开发者ID:ChandKV,项目名称:nvml,代码行数:17,代码来源:pmem_is_pmem_proc_linux.c


示例10:

struct vi_mod_t *vi_net_get_mod(struct vi_net_t *net, int node_index)
{
	struct vi_net_node_t *node;

	/* Check bounds */
	if (!IN_RANGE(node_index, 0, net->node_list->count - 1))
		panic("%s: node index out of bounds", __FUNCTION__);

	/* Return */
	node = list_get(net->node_list, node_index);
	return node->mod;
}
开发者ID:ajdupree,项目名称:cs316-m2s,代码行数:12,代码来源:net.c


示例11: dir_entry_set_owner

void dir_entry_set_owner(struct dir_t *dir, int x, int y, int z, int node)
{
	struct dir_entry_t *dir_entry;

	/* Set owner */
	assert(node == DIR_ENTRY_OWNER_NONE || IN_RANGE(node, 0, dir->num_nodes - 1));
	dir_entry = dir_entry_get(dir, x, y, z);
	dir_entry->owner = node;

	/* Trace */
	mem_trace("mem.set_owner dir=\"%s\" x=%d y=%d z=%d owner=%d\n",
		dir->name, x, y, z, node);
}
开发者ID:3upperm2n,项目名称:gpuSimulators,代码行数:13,代码来源:directory.c


示例12: ED_masklayer_frames_select_border

/* select the frames in this layer that occur within the bounds specified */
void ED_masklayer_frames_select_border(MaskLayer *masklay, float min, float max, short select_mode)
{
	MaskLayerShape *masklay_shape;

	if (masklay == NULL)
		return;

	/* only select those frames which are in bounds */
	for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) {
		if (IN_RANGE(masklay_shape->frame, min, max))
			masklayshape_select(masklay_shape, select_mode);
	}
}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:14,代码来源:mask_editaction.c


示例13: si2bin_arg_create

struct si2bin_arg_t *si2bin_arg_create_vector_register(int id)
{
	struct si2bin_arg_t *arg;

	arg = si2bin_arg_create();
	arg->type = si2bin_arg_vector_register;
	arg->value.vector_register.id = id;

	if (!IN_RANGE(arg->value.vector_register.id, 0, 255))
		si2bin_yyerror_fmt("vector register out of range: v%d", id);

	return arg;
}
开发者ID:HackLinux,项目名称:Coherence_Structures,代码行数:13,代码来源:arg.c


示例14: gc_start

static void gc_start(void) {
    scm_val v = NIL, *p ;

    STACK_INIT() ;

    for (p = stack_start; p != (scm_val *)&p; p += stack_dir)
        if (IN_RANGE(*p)) GRAY(*p) ;

    FOREACH(v, roots) {
        scm_val r = *(scm_val *)(CAR(v).p) ;
        v.c->flags = FL_GC_BLACK ;
        if (PTR_AND_NO_FLAG(r, FL_GC_GRAY)) GRAY(r) ;
    }
开发者ID:jsn,项目名称:sillyscheme,代码行数:13,代码来源:memory.c


示例15: frm_arg_create

struct frm_arg_t *frm_arg_create_scalar_register(char *name)
{
	struct frm_arg_t *arg;

	arg = frm_arg_create();
	arg->type = frm_arg_scalar_register;

	assert(name[0] == 'R');
	arg->value.scalar_register.id = atoi(name + 1);
	if (!IN_RANGE(arg->value.scalar_register.id, 0, 62))
		frm2bin_yyerror_fmt("register out of range: %s", name);

	return arg;
}
开发者ID:3upperm2n,项目名称:gpuSimulators,代码行数:14,代码来源:arg.c


示例16:

STDMETHODIMP ArrayPtrVariant<I, B>::Item(VARIANT v, I **pRet)
{
	long i = SysStatsUtils::VariantToInteger(&v);

	if (IN_RANGE(i))
	{
		*pRet = coll[i];
		(*pRet)->AddRef();
	}
	else
		*pRet = NULL;

	return S_OK;
}
开发者ID:Templier,项目名称:desktopx,代码行数:14,代码来源:ArrayPtrVariant.cpp


示例17: frm_uop_add_src_idep

static void frm_uop_add_src_idep(struct frm_uop_t *uop, struct frm_inst_t *inst, int src_idx)
{
	int sel, rel, chan, neg, abs;

	assert(uop->idep_count < FRM_UOP_MAX_IDEP);
	frm_inst_get_op_src(inst, src_idx, &sel, &rel, &chan, &neg, &abs);

	/* sel = 0..127: Value in GPR */
	if (IN_RANGE(sel, 0, 127))
		uop->idep[uop->idep_count++] = FRM_UOP_DEP_REG(sel);

	/* sel = ALU_SRC_PV */
	else if (sel == 254)
		uop->idep[uop->idep_count++] = FRM_UOP_DEP_PV;

	/* sel = ALU_SRC_PS */
	else if (sel == 255)
		uop->idep[uop->idep_count++] = FRM_UOP_DEP_PS;

	/* sel = 219..222: QA, QA.pop, QB, QB.pop */
	else if (IN_RANGE(sel, 219, 222))
		uop->idep[uop->idep_count++] = FRM_UOP_DEP_LDS;
}
开发者ID:kharthik,项目名称:miaow_dev_vin,代码行数:23,代码来源:uop.c


示例18: ASSERT

bool CSound::SetVolume( size_t nVolume  ) // region between 0 and 1000
{
	ASSERT(IN_RANGE(nVolume, 0, 1000));
	StrUtils::FormatString( m_sDeviceCommand, "setaudio %s volume to %u", m_sDeviceAlias.c_str(), nVolume );
	
	bool result = (0 == mciSendStringA( m_sDeviceCommand.c_str(), NULL, 0, 0));

	if (result)
	{
		on_volume_chnaged(nVolume);
	}
	
	return result;
}
开发者ID:starand,项目名称:cpp,代码行数:14,代码来源:sound.cpp


示例19: ipToArray

/* Parse a dotted-decimal string into an uint8_t array - return -1 on error */
static int ipToArray(const char* text, uint8_t dest[], int maxOctets, Boolean isMask)
{

    char* text_;
    char* text__;
    char* subtoken;
    char* stash = NULL;
    char* endptr;
    long octet;

    int count = 0;
    int result = 0;

    memset(&dest[0], 0, maxOctets * sizeof(uint8_t));

    text_=strdup(text);

    for(text__=text_;;text__=NULL) {

	if(count > maxOctets) {
	    result = -1;
	    goto end;
	}

	subtoken = strtok_r(text__,".",&stash);

	if(subtoken == NULL)
		goto end;

	errno = 0;
	octet=strtol(subtoken,&endptr,10);
	if(errno!=0 || !IN_RANGE(octet,0,255)) {
	    result = -1;
	    goto end;

	}

	dest[count++] = (uint8_t)octet;

	/* If we're parsing a mask and an octet is less than 0xFF, whole rest is zeros */
	if(isMask && octet < 255)
		goto end;
    }

    end:

    free(text_);
    return result;

}
开发者ID:da-phil,项目名称:ptpd,代码行数:51,代码来源:ipv4_acl.c


示例20: vi_net_attach_mod

void vi_net_attach_mod(struct vi_net_t *net,
	struct vi_mod_t *mod, int node_index)
{
	struct vi_net_node_t *node;

	/* Check bounds */
	if (!IN_RANGE(node_index, 0, net->node_list->count - 1))
		panic("%s: node index out of bounds", __FUNCTION__);

	/* Attach */
	node = list_get(net->node_list, node_index);
	assert(node);
	node->mod = mod;
}
开发者ID:ajdupree,项目名称:cs316-m2s,代码行数:14,代码来源:net.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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