slang_operation_copy(&select->children[0], &oper->children[0]);
slang_operation_copy(&select->children[1], &oper->children[1]);
select->children[2].type = SLANG_OPER_LITERAL_BOOL;
- ASSIGN_4V(select->children[2].literal, 0, 0, 0, 0);
- select->children[2].literal_size = 2;
+ ASSIGN_4V(select->children[2].literal, 0, 0, 0, 0); /* false */
+ select->children[2].literal_size = 1;
n = _slang_gen_select(A, select);
slang_operation_copy(&select->children[0], &oper->children[0]);
select->children[1].type = SLANG_OPER_LITERAL_BOOL;
- ASSIGN_4V(select->children[2].literal, 1, 1, 1, 1);
+ ASSIGN_4V(select->children[1].literal, 1, 1, 1, 1); /* true */
+ select->children[1].literal_size = 1;
slang_operation_copy(&select->children[2], &oper->children[1]);
- select->children[2].literal_size = 2;
n = _slang_gen_select(A, select);
return new_node2(IR_SGT,
_slang_gen_operation(A, &oper->children[1]),
_slang_gen_operation(A, &oper->children[0]));
- case SLANG_OPER_GREATERequal:
+ case SLANG_OPER_GREATEREQUAL:
return new_node2(IR_SGE,
_slang_gen_operation(A, &oper->children[0]),
_slang_gen_operation(A, &oper->children[1]));
- case SLANG_OPER_LESSequal:
+ case SLANG_OPER_LESSEQUAL:
/* child[0] <= child[1] ----> child[1] >= child[0] */
return new_node2(IR_SGE,
_slang_gen_operation(A, &oper->children[1]),
return 0;
break;
case OP_LESSEQUAL:
- op->type = SLANG_OPER_LESSequal;
+ op->type = SLANG_OPER_LESSEQUAL;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
case OP_GREATEREQUAL:
- op->type = SLANG_OPER_GREATERequal;
+ op->type = SLANG_OPER_GREATEREQUAL;
if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
return 0;
break;
oper->children = NULL;
oper->num_children = 0;
oper->literal[0] = 0.0;
+ oper->literal_size = 1;
oper->a_id = SLANG_ATOM_NULL;
oper->locals = _slang_variable_scope_new(NULL);
if (oper->locals == NULL)
z.literal[2] = y->literal[2];
z.literal[3] = y->literal[3];
z.literal_size = y->literal_size;
+ assert(y->literal_size >= 1);
+ assert(y->literal_size <= 4);
z.a_id = y->a_id;
if (y->locals) {
if (!slang_variable_scope_copy(z.locals, y->locals)) {
SLANG_OPER_NOTEQUAL, /* [expr] "!=" [expr] */
SLANG_OPER_LESS, /* [expr] "<" [expr] */
SLANG_OPER_GREATER, /* [expr] ">" [expr] */
- SLANG_OPER_LESSequal, /* [expr] "<=" [expr] */
- SLANG_OPER_GREATERequal, /* [expr] ">=" [expr] */
+ SLANG_OPER_LESSEQUAL, /* [expr] "<=" [expr] */
+ SLANG_OPER_GREATEREQUAL, /* [expr] ">=" [expr] */
/*SLANG_OPER_LSHIFT, */
/*SLANG_OPER_RSHIFT, */
SLANG_OPER_ADD, /* [expr] "+" [expr] */
print_binary(op, ">", indent);
break;
- case SLANG_OPER_LESSequal:
+ case SLANG_OPER_LESSEQUAL:
print_binary(op, "<=", indent);
break;
- case SLANG_OPER_GREATERequal:
+ case SLANG_OPER_GREATEREQUAL:
print_binary(op, ">=", indent);
break;