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


C++ OR函数代码示例

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


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

示例1: OR

bool OR( expression * ep, std::string header, std::string tuple )
{
  bool lhs = false;
  bool rhs = false;

  if ( ep->values[0].ep->func == OP_AND )
    lhs = AND ( ep->values[0].ep, header, tuple );
  else if ( ep->values[0].ep->func == OP_OR )
    lhs = OR ( ep->values[0].ep, header, tuple );
  else
    lhs = comparison ( ep->values[0].ep, header, tuple );

  if ( ep->values[1].ep->func == OP_AND )
    rhs = AND ( ep->values[1].ep, header, tuple );
  else if ( ep->values[1].ep->func == OP_OR )
    rhs = OR ( ep->values[1].ep, header, tuple );
  else
    rhs = comparison ( ep->values[1].ep, header, tuple );

  return lhs || rhs;
}
开发者ID:Shunxu-H,项目名称:DIY-Database,代码行数:21,代码来源:Global.cpp

示例2: assert

void
vec4_gs_visitor::gs_end_primitive()
{
    /* We can only do EndPrimitive() functionality when the control data
     * consists of cut bits.  Fortunately, the only time it isn't is when the
     * output type is points, in which case EndPrimitive() is a no-op.
     */
    if (gs_prog_data->control_data_format !=
            GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT) {
        return;
    }

    if (c->control_data_header_size_bits == 0)
        return;

    /* Cut bits use one bit per vertex. */
    assert(c->control_data_bits_per_vertex == 1);

    /* Cut bit n should be set to 1 if EndPrimitive() was called after emitting
     * vertex n, 0 otherwise.  So all we need to do here is mark bit
     * (vertex_count - 1) % 32 in the cut_bits register to indicate that
     * EndPrimitive() was called after emitting vertex (vertex_count - 1);
     * vec4_gs_visitor::emit_control_data_bits() will take care of the rest.
     *
     * Note that if EndPrimitve() is called before emitting any vertices, this
     * will cause us to set bit 31 of the control_data_bits register to 1.
     * That's fine because:
     *
     * - If max_vertices < 32, then vertex number 31 (zero-based) will never be
     *   output, so the hardware will ignore cut bit 31.
     *
     * - If max_vertices == 32, then vertex number 31 is guaranteed to be the
     *   last vertex, so setting cut bit 31 has no effect (since the primitive
     *   is automatically ended when the GS terminates).
     *
     * - If max_vertices > 32, then the ir_emit_vertex visitor will reset the
     *   control_data_bits register to 0 when the first vertex is emitted.
     */

    /* control_data_bits |= 1 << ((vertex_count - 1) % 32) */
    src_reg one(this, glsl_type::uint_type);
    emit(MOV(dst_reg(one), brw_imm_ud(1u)));
    src_reg prev_count(this, glsl_type::uint_type);
    emit(ADD(dst_reg(prev_count), this->vertex_count, brw_imm_ud(0xffffffffu)));
    src_reg mask(this, glsl_type::uint_type);
    /* Note: we're relying on the fact that the GEN SHL instruction only pays
     * attention to the lower 5 bits of its second source argument, so on this
     * architecture, 1 << (vertex_count - 1) is equivalent to 1 <<
     * ((vertex_count - 1) % 32).
     */
    emit(SHL(dst_reg(mask), one, prev_count));
    emit(OR(dst_reg(this->control_data_bits), this->control_data_bits, mask));
}
开发者ID:Echelon9,项目名称:mesa,代码行数:53,代码来源:brw_vec4_gs_visitor.cpp

示例3: ui_can_KEventProc

void ui_can_KEventProc (Widget w, struct Ui_DisplayType *displayPtr, XEvent *event)

{
    char            string[50];
    struct PosType  eventPixPos;
    KeySym          key;
    static int      loc_mode_switch = 0;

    if (displayPtr->frozen) return; /* don't accept this event here */
    
    if (event->type != KeyPress)
	return;
    
    XLookupString((XKeyEvent *) event, string, 1, &key, NULL);

    if( (key == XK_Control_L) OR (key == XK_Control_R))
	return;


    /* Process window popup requests */
    if( key == XK_Mode_switch){
	loc_mode_switch = 1;
	return;
    }
    if( loc_mode_switch == 1){
	loc_mode_switch = 0;
	ui_key_control(w,1,event);
	return;
    }


    if ((string[0] < '3') OR ((string[0] > '3') AND (string[0] < 'a')) 
      OR (string[0] > 'z'))
	return;

    eventPixPos.x     = (int) event->xkey.x;
    eventPixPos.y     = (int) event->xkey.y;
   
    ui_key_automata(displayPtr, eventPixPos, string[0]);
}
开发者ID:BackupTheBerlios,项目名称:snns-dev-svn,代码行数:40,代码来源:ui_key.c

示例4: draw_bb_grid

	static
	void
draw_bb_grid (

int		x0,
int		y0,
int		x1,
int		y1
)
{
int		nt;

	nt = grid.nt;
	if ((x0 < 0) OR (x0 >= nt)) {
		fatal ("draw_bb_grid: Bug 1.");
	}
	if ((y0 < 0) OR (y0 >= nt)) {
		fatal ("draw_bb_grid: Bug 2.");
	}
	if ((x1 < 0) OR (x1 >= nt)) {
		fatal ("draw_bb_grid: Bug 3.");
	}
	if ((y1 < 0) OR (y1 >= nt)) {
		fatal ("draw_bb_grid: Bug 4.");
	}

	/* Assume RFSTs are left-most topologies.  Plot corner	*/
	/* segments so that the vertical segment is to the left	*/
	/* of the horizontal segment.				*/

	if (x0 < x1) {
		draw_bb_grid_vertical (x0, y0, y1);
		draw_bb_grid_horizontal (x1, y1, x0);
	}
	else {
		draw_bb_grid_vertical (x1, y1, y0);
		draw_bb_grid_horizontal (x0, y0, x1);
	}
}
开发者ID:JorgeKtch,项目名称:vrp,代码行数:39,代码来源:fst2graph.c

示例5: st_finish_begin

static void			st_finish_begin(t_pos *pos, int cs, t_env *env, int i)
{
	if (OR(cs) == O)
	{
		pos->y = pos->y + i > HEIGHT - 1 ? ((pos->y + i) - (HEIGHT - 1)) - 1
			: pos->y + i;
		pos->x = pos->x - i < 0 ? WIDTH - i : pos->x - i;
		while (pos->y > HEIGHT - 1)
			pos->y = (pos->y - (HEIGHT - 1)) - 1;
		while (pos->x < 0)
			pos->x = WIDTH - abs(pos->x);
	}
	else if (OR(cs) == E)
	{
		pos->y = pos->y - i < 0 ? HEIGHT - i : pos->y - i;
		pos->x = pos->x + i > WIDTH - 1 ? ((pos->x + i) - (WIDTH - 1)) - 1
			: pos->x + i;
		while (pos->y < 0)
			pos->y = HEIGHT - abs(pos->y);
		while (pos->x > WIDTH - 1)
			pos->x = (pos->x - (WIDTH - 1)) - 1;
	}
}
开发者ID:janteuni,项目名称:Zappy,代码行数:23,代码来源:ft_treat_vision.c

示例6: main

int main(){
	int i,j;
	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d AND %d = %d\n",i,j,AND(i,j));
		}
	}
	printf("\n");

	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d OR %d = %d\n",i,j,OR(i,j));
		}
	}
	printf("\n");

	for(i=0;i<2;i++){
			printf("%d NOT = %d\n",i,NOT(i));
	}
	printf("\n");

	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d NAND %d = %d\n",i,j,NAND(i,j));
		}
	}
	printf("\n");

	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d NOR %d = %d\n",i,j,NOR(i,j));
		}
	}
	printf("\n");

	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d XOR %d = %d\n",i,j,XOR(i,j));
		}
	}
	printf("\n");

	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d XNOR %d = %d\n",i,j,XNOR(i,j));
		}
	}
	printf("\n");
    return 0;
}
开发者ID:LorhanSohaky,项目名称:LogicGate,代码行数:50,代码来源:main.c

示例7: emit

void
gen6_gs_visitor::visit(ir_end_primitive *)
{
   this->current_annotation = "gen6 end primitive";
   /* Calling EndPrimitive() is optional for point output. In this case we set
    * the PrimEnd flag when we process EmitVertex().
    */
   if (c->gp->program.OutputType == GL_POINTS)
      return;

   /* Otherwise we know that the last vertex we have processed was the last
    * vertex in the primitive and we need to set its PrimEnd flag, so do this
    * unless we haven't emitted that vertex at all (vertex_count != 0).
    *
    * Notice that we have already incremented vertex_count when we processed
    * the last emit_vertex, so we need to take that into account in the
    * comparison below (hence the num_output_vertices + 1 in the comparison
    * below).
    */
   unsigned num_output_vertices = c->gp->program.VerticesOut;
   emit(CMP(dst_null_d(), this->vertex_count, src_reg(num_output_vertices + 1),
            BRW_CONDITIONAL_L));
   vec4_instruction *inst = emit(CMP(dst_null_d(),
                                     this->vertex_count, 0u,
                                     BRW_CONDITIONAL_NEQ));
   inst->predicate = BRW_PREDICATE_NORMAL;
   emit(IF(BRW_PREDICATE_NORMAL));
   {
      /* vertex_output_offset is already pointing at the first entry of the
       * next vertex. So subtract 1 to modify the flags for the previous
       * vertex.
       */
      src_reg offset(this, glsl_type::uint_type);
      emit(ADD(dst_reg(offset), this->vertex_output_offset, src_reg(-1)));

      src_reg dst(this->vertex_output);
      dst.reladdr = ralloc(mem_ctx, src_reg);
      memcpy(dst.reladdr, &offset, sizeof(src_reg));

      emit(OR(dst_reg(dst), dst, URB_WRITE_PRIM_END));
      emit(ADD(dst_reg(this->prim_count), this->prim_count, 1u));

      /* Set the first vertex flag to indicate that the next vertex will start
       * a primitive.
       */
      emit(MOV(dst_reg(this->first_vertex), URB_WRITE_PRIM_START));
   }
   emit(BRW_OPCODE_ENDIF);
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:49,代码来源:gen6_gs_visitor.cpp

示例8: o_assert

void UndoCommand::pushCommand( UndoCommand* a_pUndoCommand )
{
    o_assert(a_pUndoCommand->m_pParent == nullptr AND (
        (getUndoStack() == nullptr) OR (m_eRedoChildExecutionPolicy < e_ChildExecutionPolicy_ForwardBeforeParent))
        );
    a_pUndoCommand->m_uiIndex = m_ChildCommands.size();
    m_ChildCommands.push_back(a_pUndoCommand);
    a_pUndoCommand->m_pParent = this;
    if(m_pUndoStack)
    {
        a_pUndoCommand->setUndoStack(m_pUndoStack);
    }

    o_emit childCommandAdded(a_pUndoCommand);
}
开发者ID:Masstronaut,项目名称:phantom-cpp,代码行数:15,代码来源:UndoCommand.cpp

示例9: print_nc_line_number

void print_nc_line_number()
{
    char text[256];
    int k;
    int m;

    rs274ngc_line_text(text, 256);
    for (k SET_TO 0;
        ((k < 256) AND
        ((text[k] IS '\t') OR (text[k] IS ' ') OR (text[k] IS '/')));
        k++);
    if ((k < 256) AND ((text[k] IS 'n') OR (text[k] IS 'N')))
    {
        fputc('N', _outfile);
        for (k++, m SET_TO 0;
            ((k < 256) AND (text[k] >= '0') AND (text[k] <= '9'));
            k++, m++)
        fputc(text[k], _outfile);
        for (; m < 6; m++)
            fputc(' ', _outfile);
    }
    else if (k < 256)
        fprintf(_outfile, "N..... ");
}
开发者ID:SherlockLee,项目名称:FileModeForInterpreter,代码行数:24,代码来源:canon_pre.c

示例10: g_unichar_isspace

/**
 * g_unichar_isspace:
 * @c: a Unicode character
 * 
 * Determines whether a character is a space, tab, or line separator
 * (newline, carriage return, etc.).  Given some UTF-8 text, obtain a
 * character value with g_utf8_get_char().
 *
 * (Note: don't use this to do word breaking; you have to use
 * Pango or equivalent to get word breaking right, the algorithm
 * is fairly complex.)
 *  
 * Return value: %TRUE if @c is a space character
 **/
gboolean
g_unichar_isspace (gunichar c)
{
  switch (c)
    {
      /* special-case these since Unicode thinks they are not spaces */
    case '\t':
    case '\n':
    case '\r':
    case '\f':
      return TRUE;
      break;
      
    default:
      {
	return IS (TYPE(c),
	           OR (G_UNICODE_SPACE_SEPARATOR,
	           OR (G_UNICODE_LINE_SEPARATOR,
                   OR (G_UNICODE_PARAGRAPH_SEPARATOR,
		  0)))) ? TRUE : FALSE;
      }
      break;
    }
}
开发者ID:antono,项目名称:glib,代码行数:38,代码来源:guniprop.c

示例11: AND

bool SamplerJitCache::Jit_TransformClutIndex(const SamplerID &id, int bitsPerIndex) {
	GEPaletteFormat fmt = (GEPaletteFormat)id.clutfmt;
	if (!id.hasClutShift && !id.hasClutMask && !id.hasClutOffset) {
		// This is simple - just mask if necessary.
		if (bitsPerIndex > 8) {
			AND(32, R(resultReg), Imm32(0x000000FF));
		}
		return true;
	}

	MOV(PTRBITS, R(tempReg1), ImmPtr(&gstate.clutformat));
	MOV(32, R(tempReg1), MatR(tempReg1));

	// Shift = (clutformat >> 2) & 0x1F
	if (id.hasClutShift) {
		MOV(32, R(RCX), R(tempReg1));
		SHR(32, R(RCX), Imm8(2));
		AND(32, R(RCX), Imm8(0x1F));
		SHR(32, R(resultReg), R(RCX));
	}

	// Mask = (clutformat >> 8) & 0xFF
	if (id.hasClutMask) {
		MOV(32, R(tempReg2), R(tempReg1));
		SHR(32, R(tempReg2), Imm8(8));
		AND(32, R(resultReg), R(tempReg2));
	}

	// We need to wrap any entries beyond the first 1024 bytes.
	u32 offsetMask = fmt == GE_CMODE_32BIT_ABGR8888 ? 0x00FF : 0x01FF;

	// We must mask to 0xFF before ORing 0x100 in 16 bit CMODEs.
	// But skip if we'll mask 0xFF after offset anyway.
	if (bitsPerIndex > 8 && (!id.hasClutOffset || offsetMask != 0x00FF)) {
		AND(32, R(resultReg), Imm32(0x000000FF));
	}

	// Offset = (clutformat >> 12) & 0x01F0
	if (id.hasClutOffset) {
		SHR(32, R(tempReg1), Imm8(16));
		SHL(32, R(tempReg1), Imm8(4));
		OR(32, R(resultReg), R(tempReg1));
		AND(32, R(resultReg), Imm32(offsetMask));
	}
	return true;
}
开发者ID:Orphis,项目名称:ppsspp,代码行数:46,代码来源:SamplerX86.cpp

示例12: MOVSS

void Jit::CompFPComp(int lhs, int rhs, u8 compare, bool allowNaN)
{
	gpr.MapReg(MIPS_REG_FPCOND, false, true);
	MOVSS(XMM0, fpr.R(lhs));
	CMPSS(XMM0, fpr.R(rhs), compare);
	MOVD_xmm(gpr.R(MIPS_REG_FPCOND), XMM0);

	// This means that NaN also means true, e.g. !<> or !>, etc.
	if (allowNaN)
	{
		MOVSS(XMM0, fpr.R(lhs));
		CMPUNORDSS(XMM0, fpr.R(rhs));

		MOVD_xmm(R(EAX), XMM0);
		OR(32, gpr.R(MIPS_REG_FPCOND), R(EAX));
	}
}
开发者ID:ANR2ME,项目名称:ppsspp,代码行数:17,代码来源:CompFPU.cpp

示例13: MOVSS

void Jit::CompFPComp(int lhs, int rhs, u8 compare, bool allowNaN)
{
	MOVSS(XMM0, fpr.R(lhs));
	CMPSS(XMM0, fpr.R(rhs), compare);
	MOVSS(M(&currentMIPS->fpcond), XMM0);

	// This means that NaN also means true, e.g. !<> or !>, etc.
	if (allowNaN)
	{
		MOVSS(XMM0, fpr.R(lhs));
		CMPUNORDSS(XMM0, fpr.R(rhs));
		MOVSS(M(&ssCompareTemp), XMM0);

		MOV(32, R(EAX), M(&ssCompareTemp));
		OR(32, M(&currentMIPS->fpcond), R(EAX));
	}
}
开发者ID:A671DR218,项目名称:ppsspp,代码行数:17,代码来源:CompFPU.cpp

示例14: g_unichar_isgraph

/**
 * g_unichar_isgraph:
 * @c: a Unicode character
 * 
 * Determines whether a character is printable and not a space
 * (returns %FALSE for control characters, format characters, and
 * spaces). g_unichar_isprint() is similar, but returns %TRUE for
 * spaces. Given some UTF-8 text, obtain a character value with
 * g_utf8_get_char().
 * 
 * Return value: %TRUE if @c is printable unless it's a space
 **/
gboolean
g_unichar_isgraph (gunichar c)
{
  return !IS (TYPE(c),
	      OR (G_UNICODE_CONTROL,
	      OR (G_UNICODE_FORMAT,
	      OR (G_UNICODE_UNASSIGNED,
	      OR (G_UNICODE_PRIVATE_USE,
	      OR (G_UNICODE_SURROGATE,
	      OR (G_UNICODE_SPACE_SEPARATOR,
	     0)))))));
}
开发者ID:FabianKnapp,项目名称:android-wmon,代码行数:24,代码来源:guniprop.c

示例15: execute_program

void execute_program(char** instructions, int n_instructions, var** vars) {
	int i;
	char instruction[16];
	char argument[128];
	for (i = 2; i < n_instructions; i++) {
		sscanf(instructions[i], "%s %[^\n]\n", instruction, argument);
		if (strcmp(instruction, "AND") == 0) {
			vars[(int) argument[4]] -> value = AND(vars[(int)argument[0]], vars[(int)argument[2]]);
		} else if (strcmp(instruction, "OR") == 0) {
			vars[(int) argument[4]] -> value = OR(vars[(int) argument[0]], vars[(int) argument[2]]);
		} else if (strcmp(instruction, "MULTIPLEXER") == 0) {
			int num_inputs;
			sscanf(argument, "%d ", &num_inputs);
			int num_selectors = (int) ceil(log2(num_inputs));
			var* inputs[num_inputs];
			var* selectors[num_selectors];
			int g;
			for (g = 0; g < num_inputs; g++) {
				inputs[g] = vars[(int) argument[g*2+2]];
			}
			for (g = 0; g < num_selectors; g++) {
				selectors[g] = vars[(int) argument[(2 * num_inputs + 2) + g * 2]];
			}
			var* output = vars[(int) argument[num_inputs*2 + num_selectors*2 + 2]];
			MULTIPLEXER(num_inputs, inputs, selectors, output);
		} else if (strcmp(instruction, "DECODER") == 0) {
			int num_inputs;
			sscanf(argument, "%d ", &num_inputs);
			int num_outputs = pow(num_inputs, 2);
			var* inputs[num_inputs];
			var* outputs[num_outputs];
			int g;
			for (g = 0; g < num_inputs; g++) {
				inputs[g] = vars[(int) argument[g*2 + 2]];
			}

			for (g = 0; g < num_outputs; g++) {
				outputs[g] = vars[(int) argument[(2 * num_inputs + 2) + g * 2]];
			}
			DECODER(num_inputs, inputs, outputs);
		}
	}

}
开发者ID:Parth-Mehrotra,项目名称:Learning,代码行数:44,代码来源:circuit.c


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