Initial parseInt using loads, see #8

This commit is contained in:
dcodeIO 2018-01-28 23:42:55 +01:00
parent 896810859e
commit 002fba3067
10 changed files with 1108 additions and 6 deletions

View File

@ -2836,6 +2836,7 @@ export class Compiler extends DiagnosticEmitter {
compileLiteralExpression(expression: LiteralExpression, contextualType: Type): ExpressionRef {
switch (expression.literalKind) {
// case LiteralKind.ARRAY:
// return this.compileStaticArray(...);
case LiteralKind.FLOAT: {
var floatValue = (<FloatLiteralExpression>expression).value;
@ -2903,6 +2904,10 @@ export class Compiler extends DiagnosticEmitter {
: this.module.createI32(stringOffset.lo);
}
compileStaticArray(elementType: Type, expressions: Expression): ExpressionRef {
throw new Error("not implemented");
}
compileNewExpression(expression: NewExpression, contextualType: Type): ExpressionRef {
var resolved = this.program.resolveExpression(expression.expression, this.currentFunction); // reports
if (resolved) {

View File

@ -322,9 +322,100 @@ function isWhiteSpaceOrLineTerminator(c: u16): bool {
}
}
// @binding(CALL, [ STRING, PASS_THRU ], PASS_THRU)
export function parseInt(str: string, radix: i32 = 10): f64 {
throw new Error("not implemented");
const enum CharCode {
PLUS = 0x2B,
MINUS = 0x2D,
_0 = 0x30,
_1 = 0x31,
_2 = 0x32,
_3 = 0x33,
_4 = 0x34,
_5 = 0x35,
_6 = 0x36,
_7 = 0x37,
_8 = 0x38,
_9 = 0x39,
A = 0x41,
B = 0x42,
O = 0x4F,
X = 0x58,
Z = 0x5a,
a = 0x61,
b = 0x62,
o = 0x6F,
x = 0x78,
z = 0x7A
}
export function parseInt(str: String, radix: i32 = 0): i64 {
var len = str.length;
var ptr = changetype<usize>(str) + HEAD;
if (!len)
return 0; // (NaN)
var code = <i32>load<u16>(ptr);
// determine sign
var sign: i64;
if (code == CharCode.MINUS) {
if (!--len)
return 0; // (NaN)
code = <i32>load<u16>(ptr += 2);
sign = -1;
} else if (code == CharCode.PLUS) {
if (!--len)
return 0; // (NaN)
code = <i32>load<u16>(ptr += 2);
sign = 1;
} else
sign = 1;
// determine radix
if (!radix) {
if (code == CharCode._0 && len > 2) {
switch (<i32>load<u16>(ptr + 2)) {
case CharCode.B:
case CharCode.b:
ptr += 4; len -= 2;
radix = 2;
break;
case CharCode.O:
case CharCode.o:
ptr += 4; len -= 2;
radix = 8;
break;
case CharCode.X:
case CharCode.x:
ptr += 4; len -= 2;
radix = 16;
break;
default:
radix = 10;
}
} else radix = 10;
}
// calculate value
var num: i64 = 0;
while (len--) {
code = <i32>load<u16>(ptr);
if (code >= CharCode._0 && code <= CharCode._9)
code -= CharCode._0;
else if (code >= CharCode.A && code <= CharCode.Z)
code -= CharCode.A - 10;
else if (code >= CharCode.a && code <= CharCode.z)
code -= CharCode.a - 10;
else
return sign * num;
if (code >= radix)
return sign * num;
num = (num * radix) + code;
ptr += 2;
}
return sign * num;
}
// @binding(CALL, [ STRING ], PASS_THRU)

View File

@ -4073,6 +4073,7 @@
FUNCTION_PROTOTYPE: std:string/String.__eq
CLASS_PROTOTYPE: String
FUNCTION_PROTOTYPE: std:string/isWhiteSpaceOrLineTerminator
ENUM: std:string/CharCode
FUNCTION_PROTOTYPE: std:string/parseInt
FUNCTION_PROTOTYPE: parseInt
FUNCTION_PROTOTYPE: std:string/parseFloat

View File

@ -280,6 +280,7 @@
FUNCTION_PROTOTYPE: std:string/String.__eq
CLASS_PROTOTYPE: String
FUNCTION_PROTOTYPE: std:string/isWhiteSpaceOrLineTerminator
ENUM: std:string/CharCode
FUNCTION_PROTOTYPE: std:string/parseInt
FUNCTION_PROTOTYPE: parseInt
FUNCTION_PROTOTYPE: std:string/parseFloat

View File

@ -2889,6 +2889,7 @@
FUNCTION_PROTOTYPE: std:string/String.__eq
CLASS_PROTOTYPE: String
FUNCTION_PROTOTYPE: std:string/isWhiteSpaceOrLineTerminator
ENUM: std:string/CharCode
FUNCTION_PROTOTYPE: std:string/parseInt
FUNCTION_PROTOTYPE: parseInt
FUNCTION_PROTOTYPE: std:string/parseFloat

View File

@ -230,6 +230,7 @@
FUNCTION_PROTOTYPE: std:string/String.__eq
CLASS_PROTOTYPE: String
FUNCTION_PROTOTYPE: std:string/isWhiteSpaceOrLineTerminator
ENUM: std:string/CharCode
FUNCTION_PROTOTYPE: std:string/parseInt
FUNCTION_PROTOTYPE: parseInt
FUNCTION_PROTOTYPE: std:string/parseFloat

View File

@ -2798,6 +2798,7 @@
FUNCTION_PROTOTYPE: std:string/String.__eq
CLASS_PROTOTYPE: String
FUNCTION_PROTOTYPE: std:string/isWhiteSpaceOrLineTerminator
ENUM: std:string/CharCode
FUNCTION_PROTOTYPE: std:string/parseInt
FUNCTION_PROTOTYPE: parseInt
FUNCTION_PROTOTYPE: std:string/parseFloat

View File

@ -2,6 +2,7 @@
(type $i (func (result i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $iiI (func (param i32 i32) (result i64)))
(type $v (func))
(global $std/string/str (mut i32) (i32.const 8))
(memory $0 1)
@ -12,6 +13,14 @@
(data (i32.const 88) "\03\00\00\00I\00\'\00m")
(data (i32.const 104) "\01\00\00\00,")
(data (i32.const 112) "\01\00\00\00x")
(data (i32.const 120) "\01\00\00\000")
(data (i32.const 128) "\01\00\00\001")
(data (i32.const 136) "\05\00\00\000\00b\001\000\001")
(data (i32.const 152) "\05\00\00\000\00o\007\000\007")
(data (i32.const 168) "\05\00\00\000\00x\00f\000\00f")
(data (i32.const 184) "\05\00\00\000\00x\00F\000\00F")
(data (i32.const 200) "\03\00\00\000\001\001")
(data (i32.const 216) "\04\00\00\000\00x\001\00g")
(export "getString" (func $std/string/getString))
(export "memory" (memory $0))
(start $start)
@ -361,7 +370,369 @@
(func $std/string/getString (; 5 ;) (type $i) (result i32)
(get_global $std/string/str)
)
(func $start (; 6 ;) (type $v)
(func $std:string/parseInt (; 6 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64)
(local $2 i32)
(local $3 i32)
(local $4 i64)
(local $5 i64)
(set_local $3
(i32.add
(get_local $0)
(i32.const 4)
)
)
(if
(i32.eqz
(tee_local $0
(i32.load
(get_local $0)
)
)
)
(return
(i64.const 0)
)
)
(set_local $5
(if (result i64)
(i32.eq
(tee_local $2
(i32.load16_u
(get_local $3)
)
)
(i32.const 45)
)
(block (result i64)
(if
(i32.eqz
(tee_local $0
(i32.sub
(get_local $0)
(i32.const 1)
)
)
)
(return
(i64.const 0)
)
)
(set_local $2
(i32.load16_u
(tee_local $3
(i32.add
(get_local $3)
(i32.const 2)
)
)
)
)
(i64.const -1)
)
(if (result i64)
(i32.eq
(get_local $2)
(i32.const 43)
)
(block (result i64)
(if
(i32.eqz
(tee_local $0
(i32.sub
(get_local $0)
(i32.const 1)
)
)
)
(return
(i64.const 0)
)
)
(set_local $2
(i32.load16_u
(tee_local $3
(i32.add
(get_local $3)
(i32.const 2)
)
)
)
)
(i64.const 1)
)
(i64.const 1)
)
)
)
(if
(i32.eqz
(get_local $1)
)
(set_local $1
(if (result i32)
(i32.and
(select
(i32.gt_s
(get_local $0)
(i32.const 2)
)
(i32.eq
(get_local $2)
(i32.const 48)
)
(i32.eq
(get_local $2)
(i32.const 48)
)
)
(i32.const 1)
)
(block $break|0 (result i32)
(block $case6|0
(block $case5|0
(block $case3|0
(if
(i32.eqz
(i32.or
(i32.eq
(tee_local $2
(i32.load16_u
(i32.add
(get_local $3)
(i32.const 2)
)
)
)
(i32.const 66)
)
(i32.eq
(get_local $2)
(i32.const 98)
)
)
)
(block
(br_if $case3|0
(i32.or
(i32.eq
(get_local $2)
(i32.const 79)
)
(i32.eq
(get_local $2)
(i32.const 111)
)
)
)
(br_if $case5|0
(i32.or
(i32.eq
(get_local $2)
(i32.const 88)
)
(i32.eq
(get_local $2)
(i32.const 120)
)
)
)
(br $case6|0)
)
)
(set_local $3
(i32.add
(get_local $3)
(i32.const 4)
)
)
(set_local $0
(i32.sub
(get_local $0)
(i32.const 2)
)
)
(br $break|0
(i32.const 2)
)
)
(set_local $3
(i32.add
(get_local $3)
(i32.const 4)
)
)
(set_local $0
(i32.sub
(get_local $0)
(i32.const 2)
)
)
(br $break|0
(i32.const 8)
)
)
(set_local $3
(i32.add
(get_local $3)
(i32.const 4)
)
)
(set_local $0
(i32.sub
(get_local $0)
(i32.const 2)
)
)
(br $break|0
(i32.const 16)
)
)
(i32.const 10)
)
(i32.const 10)
)
)
)
(loop $continue|1
(if
(block (result i32)
(set_local $0
(i32.sub
(tee_local $2
(get_local $0)
)
(i32.const 1)
)
)
(get_local $2)
)
(block
(if
(i32.and
(select
(i32.le_s
(tee_local $2
(i32.load16_u
(get_local $3)
)
)
(i32.const 57)
)
(i32.ge_s
(get_local $2)
(i32.const 48)
)
(i32.ge_s
(get_local $2)
(i32.const 48)
)
)
(i32.const 1)
)
(set_local $2
(i32.sub
(get_local $2)
(i32.const 48)
)
)
(if
(i32.and
(select
(i32.le_s
(get_local $2)
(i32.const 90)
)
(i32.ge_s
(get_local $2)
(i32.const 65)
)
(i32.ge_s
(get_local $2)
(i32.const 65)
)
)
(i32.const 1)
)
(set_local $2
(i32.sub
(get_local $2)
(i32.const 55)
)
)
(if
(i32.and
(select
(i32.le_s
(get_local $2)
(i32.const 122)
)
(i32.ge_s
(get_local $2)
(i32.const 97)
)
(i32.ge_s
(get_local $2)
(i32.const 97)
)
)
(i32.const 1)
)
(set_local $2
(i32.sub
(get_local $2)
(i32.const 87)
)
)
(return
(i64.mul
(get_local $5)
(get_local $4)
)
)
)
)
)
(if
(i32.ge_s
(get_local $2)
(get_local $1)
)
(return
(i64.mul
(get_local $5)
(get_local $4)
)
)
)
(set_local $4
(i64.add
(i64.mul
(get_local $4)
(i64.extend_s/i32
(get_local $1)
)
)
(i64.extend_s/i32
(get_local $2)
)
)
)
(set_local $3
(i32.add
(get_local $3)
(i32.const 2)
)
)
(br $continue|1)
)
)
)
(i64.mul
(get_local $5)
(get_local $4)
)
)
(func $start (; 7 ;) (type $v)
(if
(i32.ne
(get_global $std/string/str)
@ -443,5 +814,85 @@
)
(unreachable)
)
(if
(i64.ne
(call $std:string/parseInt
(i32.const 120)
(i32.const 0)
)
(i64.const 0)
)
(unreachable)
)
(if
(i64.ne
(call $std:string/parseInt
(i32.const 128)
(i32.const 0)
)
(i64.const 1)
)
(unreachable)
)
(if
(i64.ne
(call $std:string/parseInt
(i32.const 136)
(i32.const 0)
)
(i64.const 5)
)
(unreachable)
)
(if
(i64.ne
(call $std:string/parseInt
(i32.const 152)
(i32.const 0)
)
(i64.const 455)
)
(unreachable)
)
(if
(i64.ne
(call $std:string/parseInt
(i32.const 168)
(i32.const 0)
)
(i64.const 3855)
)
(unreachable)
)
(if
(i64.ne
(call $std:string/parseInt
(i32.const 184)
(i32.const 0)
)
(i64.const 3855)
)
(unreachable)
)
(if
(i64.ne
(call $std:string/parseInt
(i32.const 200)
(i32.const 0)
)
(i64.const 11)
)
(unreachable)
)
(if
(i64.ne
(call $std:string/parseInt
(i32.const 216)
(i32.const 0)
)
(i64.const 1)
)
(unreachable)
)
)
)

View File

@ -16,3 +16,12 @@ assert(str.indexOf("x") == -1);
export function getString(): string {
return str;
}
assert(parseInt("0") == 0);
assert(parseInt("1") == 1);
assert(parseInt("0b101") == 0b101);
assert(parseInt("0o707") == 0o707);
assert(parseInt("0xf0f") == 0xf0f);
assert(parseInt("0xF0F") == 0xf0f);
assert(parseInt("011") == 11); // not octal
assert(parseInt("0x1g") == 1); // not valid

View File

@ -2,10 +2,33 @@
(type $i (func (result i32)))
(type $iii (func (param i32 i32) (result i32)))
(type $iiii (func (param i32 i32 i32) (result i32)))
(type $iiI (func (param i32 i32) (result i64)))
(type $v (func))
(global $std/string/str (mut i32) (i32.const 8))
(global $std:string/HEAD i32 (i32.const 4))
(global $HEAP_BASE i32 (i32.const 118))
(global $std:string/CharCode.PLUS i32 (i32.const 43))
(global $std:string/CharCode.MINUS i32 (i32.const 45))
(global $std:string/CharCode._0 i32 (i32.const 48))
(global $std:string/CharCode._1 i32 (i32.const 49))
(global $std:string/CharCode._2 i32 (i32.const 50))
(global $std:string/CharCode._3 i32 (i32.const 51))
(global $std:string/CharCode._4 i32 (i32.const 52))
(global $std:string/CharCode._5 i32 (i32.const 53))
(global $std:string/CharCode._6 i32 (i32.const 54))
(global $std:string/CharCode._7 i32 (i32.const 55))
(global $std:string/CharCode._8 i32 (i32.const 56))
(global $std:string/CharCode._9 i32 (i32.const 57))
(global $std:string/CharCode.A i32 (i32.const 65))
(global $std:string/CharCode.B i32 (i32.const 66))
(global $std:string/CharCode.O i32 (i32.const 79))
(global $std:string/CharCode.X i32 (i32.const 88))
(global $std:string/CharCode.Z i32 (i32.const 90))
(global $std:string/CharCode.a i32 (i32.const 97))
(global $std:string/CharCode.b i32 (i32.const 98))
(global $std:string/CharCode.o i32 (i32.const 111))
(global $std:string/CharCode.x i32 (i32.const 120))
(global $std:string/CharCode.z i32 (i32.const 122))
(global $HEAP_BASE i32 (i32.const 228))
(memory $0 1)
(data (i32.const 8) "\10\00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g\00")
(data (i32.const 48) "\02\00\00\00h\00i\00")
@ -14,6 +37,14 @@
(data (i32.const 88) "\03\00\00\00I\00\'\00m\00")
(data (i32.const 104) "\01\00\00\00,\00")
(data (i32.const 112) "\01\00\00\00x\00")
(data (i32.const 120) "\01\00\00\000\00")
(data (i32.const 128) "\01\00\00\001\00")
(data (i32.const 136) "\05\00\00\000\00b\001\000\001\00")
(data (i32.const 152) "\05\00\00\000\00o\007\000\007\00")
(data (i32.const 168) "\05\00\00\000\00x\00f\000\00f\00")
(data (i32.const 184) "\05\00\00\000\00x\00F\000\00F\00")
(data (i32.const 200) "\03\00\00\000\001\001\00")
(data (i32.const 216) "\04\00\00\000\00x\001\00g\00")
(export "getString" (func $std/string/getString))
(export "memory" (memory $0))
(start $start)
@ -461,7 +492,420 @@
(get_global $std/string/str)
)
)
(func $start (; 7 ;) (type $v)
(func $std:string/parseInt (; 7 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i64)
(local $6 i32)
(local $7 i64)
(set_local $2
(i32.load
(get_local $0)
)
)
(set_local $3
(i32.add
(get_local $0)
(i32.const 4)
)
)
(if
(i32.eqz
(get_local $2)
)
(return
(i64.const 0)
)
)
(set_local $4
(i32.load16_u
(get_local $3)
)
)
(nop)
(if
(i32.eq
(get_local $4)
(i32.const 45)
)
(block
(if
(i32.eqz
(tee_local $2
(i32.sub
(get_local $2)
(i32.const 1)
)
)
)
(return
(i64.const 0)
)
)
(set_local $4
(i32.load16_u
(tee_local $3
(i32.add
(get_local $3)
(i32.const 2)
)
)
)
)
(set_local $5
(i64.sub
(i64.const 0)
(i64.const 1)
)
)
)
(if
(i32.eq
(get_local $4)
(i32.const 43)
)
(block
(if
(i32.eqz
(tee_local $2
(i32.sub
(get_local $2)
(i32.const 1)
)
)
)
(return
(i64.const 0)
)
)
(set_local $4
(i32.load16_u
(tee_local $3
(i32.add
(get_local $3)
(i32.const 2)
)
)
)
)
(set_local $5
(i64.const 1)
)
)
(set_local $5
(i64.const 1)
)
)
)
(if
(i32.eqz
(get_local $1)
)
(if
(i32.and
(if (result i32)
(i32.ne
(i32.eq
(get_local $4)
(i32.const 48)
)
(i32.const 0)
)
(i32.gt_s
(get_local $2)
(i32.const 2)
)
(i32.eq
(get_local $4)
(i32.const 48)
)
)
(i32.const 1)
)
(block $break|0
(block $case6|0
(block $case5|0
(block $case4|0
(block $case3|0
(block $case2|0
(block $case1|0
(block $case0|0
(set_local $6
(i32.load16_u
(i32.add
(get_local $3)
(i32.const 2)
)
)
)
(br_if $case0|0
(i32.eq
(get_local $6)
(i32.const 66)
)
)
(br_if $case1|0
(i32.eq
(get_local $6)
(i32.const 98)
)
)
(br_if $case2|0
(i32.eq
(get_local $6)
(i32.const 79)
)
)
(br_if $case3|0
(i32.eq
(get_local $6)
(i32.const 111)
)
)
(br_if $case4|0
(i32.eq
(get_local $6)
(i32.const 88)
)
)
(br_if $case5|0
(i32.eq
(get_local $6)
(i32.const 120)
)
)
(br $case6|0)
)
)
(set_local $3
(i32.add
(get_local $3)
(i32.const 4)
)
)
(set_local $2
(i32.sub
(get_local $2)
(i32.const 2)
)
)
(set_local $1
(i32.const 2)
)
(br $break|0)
)
)
(set_local $3
(i32.add
(get_local $3)
(i32.const 4)
)
)
(set_local $2
(i32.sub
(get_local $2)
(i32.const 2)
)
)
(set_local $1
(i32.const 8)
)
(br $break|0)
)
)
(set_local $3
(i32.add
(get_local $3)
(i32.const 4)
)
)
(set_local $2
(i32.sub
(get_local $2)
(i32.const 2)
)
)
(set_local $1
(i32.const 16)
)
(br $break|0)
)
(set_local $1
(i32.const 10)
)
)
(set_local $1
(i32.const 10)
)
)
)
(set_local $7
(i64.const 0)
)
(block $break|1
(loop $continue|1
(if
(block (result i32)
(set_local $6
(get_local $2)
)
(set_local $2
(i32.sub
(get_local $6)
(i32.const 1)
)
)
(get_local $6)
)
(block
(block
(set_local $4
(i32.load16_u
(get_local $3)
)
)
(if
(i32.and
(if (result i32)
(i32.ne
(i32.ge_s
(get_local $4)
(i32.const 48)
)
(i32.const 0)
)
(i32.le_s
(get_local $4)
(i32.const 57)
)
(i32.ge_s
(get_local $4)
(i32.const 48)
)
)
(i32.const 1)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 48)
)
)
(if
(i32.and
(if (result i32)
(i32.ne
(i32.ge_s
(get_local $4)
(i32.const 65)
)
(i32.const 0)
)
(i32.le_s
(get_local $4)
(i32.const 90)
)
(i32.ge_s
(get_local $4)
(i32.const 65)
)
)
(i32.const 1)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.sub
(i32.const 65)
(i32.const 10)
)
)
)
(if
(i32.and
(if (result i32)
(i32.ne
(i32.ge_s
(get_local $4)
(i32.const 97)
)
(i32.const 0)
)
(i32.le_s
(get_local $4)
(i32.const 122)
)
(i32.ge_s
(get_local $4)
(i32.const 97)
)
)
(i32.const 1)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.sub
(i32.const 97)
(i32.const 10)
)
)
)
(return
(i64.mul
(get_local $5)
(get_local $7)
)
)
)
)
)
(if
(i32.ge_s
(get_local $4)
(get_local $1)
)
(return
(i64.mul
(get_local $5)
(get_local $7)
)
)
)
(set_local $7
(i64.add
(i64.mul
(get_local $7)
(i64.extend_s/i32
(get_local $1)
)
)
(i64.extend_s/i32
(get_local $4)
)
)
)
(set_local $3
(i32.add
(get_local $3)
(i32.const 2)
)
)
)
(br $continue|1)
)
)
)
)
(return
(i64.mul
(get_local $5)
(get_local $7)
)
)
)
(func $start (; 8 ;) (type $v)
(if
(i32.eqz
(i32.eq
@ -553,6 +997,102 @@
)
(unreachable)
)
(if
(i32.eqz
(i64.eq
(call $std:string/parseInt
(i32.const 120)
(i32.const 0)
)
(i64.const 0)
)
)
(unreachable)
)
(if
(i32.eqz
(i64.eq
(call $std:string/parseInt
(i32.const 128)
(i32.const 0)
)
(i64.const 1)
)
)
(unreachable)
)
(if
(i32.eqz
(i64.eq
(call $std:string/parseInt
(i32.const 136)
(i32.const 0)
)
(i64.const 5)
)
)
(unreachable)
)
(if
(i32.eqz
(i64.eq
(call $std:string/parseInt
(i32.const 152)
(i32.const 0)
)
(i64.const 455)
)
)
(unreachable)
)
(if
(i32.eqz
(i64.eq
(call $std:string/parseInt
(i32.const 168)
(i32.const 0)
)
(i64.const 3855)
)
)
(unreachable)
)
(if
(i32.eqz
(i64.eq
(call $std:string/parseInt
(i32.const 184)
(i32.const 0)
)
(i64.const 3855)
)
)
(unreachable)
)
(if
(i32.eqz
(i64.eq
(call $std:string/parseInt
(i32.const 200)
(i32.const 0)
)
(i64.const 11)
)
)
(unreachable)
)
(if
(i32.eqz
(i64.eq
(call $std:string/parseInt
(i32.const 216)
(i32.const 0)
)
(i64.const 1)
)
)
(unreachable)
)
)
)
(;
@ -630,6 +1170,7 @@
FUNCTION_PROTOTYPE: std:string/String.__eq
CLASS_PROTOTYPE: String
FUNCTION_PROTOTYPE: std:string/isWhiteSpaceOrLineTerminator
ENUM: std:string/CharCode
FUNCTION_PROTOTYPE: std:string/parseInt
FUNCTION_PROTOTYPE: parseInt
FUNCTION_PROTOTYPE: std:string/parseFloat