MCPcopy Create free account
hub / github.com/dfranx/ShaderDebugger / lib_common_vec_operator_minus

Function lib_common_vec_operator_minus

src/CommonLibrary.cpp:396–428  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394 return ret;
395 }
396 bv_variable lib_common_vec_operator_minus(bv_program* prog, bv_object* me, u8 count, bv_variable* args)
397 {
398 bv_variable ret = bv_variable_create_void();
399
400 if (count == 1) {
401 // vec - vec
402 if (args[0].type == bv_type_object) {
403 bv_object* vec = bv_variable_get_object(args[0]);
404
405 bv_type mtype = merge_type(me->prop[0].type, vec->prop[0].type);
406
407 ret = create_vec(prog, mtype, me->type->props.name_count);
408 bv_object* retObj = bv_variable_get_object(ret);
409
410 for (u16 i = 0; i < me->type->props.name_count; i++) {
411 bv_variable_deinitialize(&retObj->prop[i]);
412 retObj->prop[i] = bv_variable_cast(mtype, bv_variable_op_subtract(prog, me->prop[i], vec->prop[i]));
413 }
414 }
415 }
416 else if (count == 0) {
417 ret = bv_variable_create_object(me->type);
418
419 bv_object* retObj = bv_variable_get_object(ret);
420
421 for (u16 i = 0; i < me->type->props.name_count; i++) {
422 bv_variable_deinitialize(&retObj->prop[i]);
423 retObj->prop[i] = bv_variable_op_negate(prog, me->prop[i]);
424 }
425 }
426
427 return ret;
428 }
429 bv_variable lib_common_vec_operator_greater(bv_program* prog, bv_object* me, u8 count, bv_variable* args)
430 {
431 bv_variable ret = bv_variable_create_uchar(0);

Callers

nothing calls this directly

Calls 2

merge_typeFunction · 0.85
create_vecFunction · 0.85

Tested by

no test coverage detected