| 116 | } |
| 117 | |
| 118 | txNumber fx_BigInt_asAux(txMachine* the) |
| 119 | { |
| 120 | txNumber value, index; |
| 121 | if (mxArgc < 1) |
| 122 | index = 0; |
| 123 | else { |
| 124 | if (mxArgv(0)->kind == XS_UNDEFINED_KIND) |
| 125 | index = 0; |
| 126 | else { |
| 127 | value = fxToNumber(the, mxArgv(0)); |
| 128 | if (c_isnan(value)) |
| 129 | index = 0; |
| 130 | else { |
| 131 | value = c_trunc(value); |
| 132 | if (value < 0) |
| 133 | mxRangeError("index < 0"); |
| 134 | index = value; |
| 135 | if (index <= 0) |
| 136 | index = 0; |
| 137 | else if (index > C_MAX_SAFE_INTEGER) |
| 138 | index = C_MAX_SAFE_INTEGER; |
| 139 | if (value != index) |
| 140 | mxRangeError("invalid index"); |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | if (mxArgc < 2) |
| 145 | mxTypeError("no bigint"); |
| 146 | return index; |
| 147 | } |
| 148 | |
| 149 | void fx_BigInt_asIntN(txMachine* the) |
| 150 | { |
no test coverage detected