glsl: Refactor get_num_operands.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 17 Nov 2010 23:31:35 +0000 (15:31 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 17 Nov 2010 23:44:41 +0000 (15:44 -0800)
commit007f4881503b69055d65cfb20bd237673779786b
tree0bad86d646d9a0b473574039312cfa0181cfeab6
parent7ffd4e976fd11b8c083c2927effd25a2f79ac841
glsl: Refactor get_num_operands.

This adds sentinel values to the ir_expression_operation enum type:
ir_last_unop, ir_last_binop, and ir_last_opcode.  They are set to the
previous one so they don't trigger "unhandled case in switch statement"
warnings, but should never be handled directly.

This allows us to remove the huge array of 1s and 2s in
ir_expression::get_num_operands().
src/glsl/ir.cpp
src/glsl/ir.h