| 392 | } |
| 393 | |
| 394 | txS8 fxArgToSafeByteLength(txMachine* the, txInteger argi, txInteger length) |
| 395 | { |
| 396 | txSlot *arg = mxArgv(argi); |
| 397 | if ((mxArgc > argi) && (arg->kind != XS_UNDEFINED_KIND)) { |
| 398 | txNumber value; |
| 399 | if (XS_INTEGER_KIND == arg->kind) { |
| 400 | txS8 value = arg->value.integer; |
| 401 | if (value < 0) |
| 402 | mxRangeError("byteLength < 0"); |
| 403 | return value; |
| 404 | } |
| 405 | value = c_trunc(fxToNumber(the, arg)); |
| 406 | if (c_isnan(value)) |
| 407 | return 0; |
| 408 | if (value < 0) |
| 409 | mxRangeError("byteLength < 0"); |
| 410 | if (C_MAX_SAFE_INTEGER < value) |
| 411 | mxRangeError("byteLength too big"); |
| 412 | return (txS8)value; |
| 413 | } |
| 414 | return length; |
| 415 | } |
| 416 | |
| 417 | txSlot* fxArgToInstance(txMachine* the, txInteger i) |
| 418 | { |
no test coverage detected