MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxToLength

Function fxToLength

xs/sources/xsArray.c:935–961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

933}
934
935txNumber fxToLength(txMachine* the, txSlot* slot)
936{
937again:
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
963void fxArrayLengthGetter(txMachine* the)
964{

Callers 15

fx_parseURLFunction · 0.85
fx_parseURLCopyPathFunction · 0.85
fx_parseURLPushPathFunction · 0.85
fx_parseURLShortenPathFunction · 0.85
fx_serializeURLFunction · 0.85
fx_serializeQueryFunction · 0.85
fx_RegExp_prototype_execFunction · 0.85
fxGetArrayLengthFunction · 0.85

Calls 1

fxToNumberFunction · 0.85

Tested by

no test coverage detected