Browse Source

Refactor ir_expression::get_num_operands.

A new static version takes an ir_expression_operation enum, and the
original non-static version now uses it.  This will make it easier to
read operations (where the ir_expression doesn't yet exist).
tags/mesa-7.9-rc1
Kenneth Graunke 15 years ago
parent
commit
7dd6adbe2e
2 changed files with 7 additions and 3 deletions
  1. 2
    2
      ir.cpp
  2. 5
    1
      ir.h

+ 2
- 2
ir.cpp View File

@@ -46,7 +46,7 @@ ir_expression::ir_expression(int op, const struct glsl_type *type,
}

unsigned int
ir_expression::get_num_operands(void)
ir_expression::get_num_operands(ir_expression_operation op)
{
/* Update ir_print_visitor.cpp when updating this list. */
const int num_operands[] = {
@@ -105,7 +105,7 @@ ir_expression::get_num_operands(void)

assert(sizeof(num_operands) / sizeof(num_operands[0]) == ir_binop_pow + 1);

return num_operands[this->operation];
return num_operands[op];
}



+ 5
- 1
ir.h View File

@@ -471,7 +471,11 @@ public:
ir_expression(int op, const struct glsl_type *type,
ir_rvalue *, ir_rvalue *);

unsigned int get_num_operands(void);
static unsigned int get_num_operands(ir_expression_operation);
unsigned int get_num_operands()
{
return get_num_operands(operation);
}

virtual void accept(ir_visitor *v)
{

Loading…
Cancel
Save