| 762 | return ret; |
| 763 | } |
| 764 | bv_variable lib_common_mat_operator_array_set(bv_program* prog, bv_object* me, u8 count, bv_variable* args) |
| 765 | { |
| 766 | u8 argCount = count; |
| 767 | u8 indCount = 0; |
| 768 | if (argCount > 1) |
| 769 | indCount = bv_variable_get_int(args[0]); |
| 770 | |
| 771 | sd::Matrix* myData = (sd::Matrix*)me->user_data; |
| 772 | |
| 773 | // set vector |
| 774 | if (indCount == 1 && argCount > 2) { |
| 775 | int col = 0; |
| 776 | |
| 777 | if (bv_type_is_integer(args[1].type)) |
| 778 | col = bv_variable_get_int(args[1]); |
| 779 | else if (args[1].type == bv_type_float) |
| 780 | col = bv_variable_get_float(args[1]); |
| 781 | |
| 782 | if (col >= myData->Columns) |
| 783 | col = myData->Columns - 1; |
| 784 | if (col < 0) |
| 785 | col = 0; |
| 786 | |
| 787 | sd::Matrix* myData = (sd::Matrix*)me->user_data; |
| 788 | |
| 789 | bv_object* retObj = bv_variable_get_object(args[2]); |
| 790 | for (u16 i = 0; i < retObj->type->props.name_count; i++) |
| 791 | myData->Data[col][i] = bv_variable_get_float(bv_variable_cast(bv_type_float, retObj->prop[i])); |
| 792 | } |
| 793 | // set float |
| 794 | else if (indCount == 2 && argCount > 3) { |
| 795 | // column |
| 796 | int col = 0; |
| 797 | |
| 798 | if (bv_type_is_integer(args[1].type)) |
| 799 | col = bv_variable_get_int(args[1]); |
| 800 | else if (args[1].type == bv_type_float) |
| 801 | col = bv_variable_get_float(args[1]); |
| 802 | |
| 803 | if (col >= myData->Columns) |
| 804 | col = myData->Columns - 1; |
| 805 | if (col < 0) |
| 806 | col = 0; |
| 807 | |
| 808 | // row |
| 809 | int row = 0; |
| 810 | |
| 811 | if (bv_type_is_integer(args[2].type)) |
| 812 | row = bv_variable_get_int(args[2]); |
| 813 | else if (args[1].type == bv_type_float) |
| 814 | row = bv_variable_get_float(args[2]); |
| 815 | |
| 816 | if (row >= myData->Rows) |
| 817 | row = myData->Rows - 1; |
| 818 | if (row < 0) |
| 819 | row = 0; |
| 820 | |
| 821 | float scalar = bv_variable_get_float(bv_variable_cast(bv_type_float, args[3])); |
nothing calls this directly
no outgoing calls
no test coverage detected