| 933 | } |
| 934 | |
| 935 | txNumber fxToLength(txMachine* the, txSlot* slot) |
| 936 | { |
| 937 | again: |
| 938 | if (slot->kind == XS_INTEGER_KIND) { |
| 939 | txInteger length = slot->value.integer; |
| 940 | if (length < 0) |
| 941 | length = 0; |
| 942 | slot->value.number = (txNumber)length; |
| 943 | slot->kind = XS_NUMBER_KIND; |
| 944 | return (txNumber)length; |
| 945 | } |
| 946 | if (slot->kind == XS_NUMBER_KIND) { |
| 947 | txNumber length = slot->value.number; |
| 948 | if (c_isnan(length)) |
| 949 | length = 0; |
| 950 | else if (length <= 0) |
| 951 | length = 0; |
| 952 | else if (length > C_MAX_SAFE_INTEGER) |
| 953 | length = C_MAX_SAFE_INTEGER; |
| 954 | else |
| 955 | length = c_trunc(length); |
| 956 | slot->value.number = length; |
| 957 | return length; |
| 958 | } |
| 959 | fxToNumber(the, slot); |
| 960 | goto again; |
| 961 | } |
| 962 | |
| 963 | void fxArrayLengthGetter(txMachine* the) |
| 964 | { |
no test coverage detected