diff options
author | John Högberg <[email protected]> | 2019-01-10 09:41:23 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-01-10 09:41:23 +0100 |
commit | 78e67434b34813b8efe61f8e8dca445dd12b0f7b (patch) | |
tree | 38212f3401c5c5c9d839ca65f906112b1cc51ca6 /erts/preloaded | |
parent | 6120af3481f9deac2be1ff4bbb2684f24ef172eb (diff) | |
parent | 46c7a85d70ee6d060a393ca4b22b06eef6fbb324 (diff) | |
download | otp-78e67434b34813b8efe61f8e8dca445dd12b0f7b.tar.gz otp-78e67434b34813b8efe61f8e8dca445dd12b0f7b.tar.bz2 otp-78e67434b34813b8efe61f8e8dca445dd12b0f7b.zip |
Merge branch 'john/erts/int_to_list_by_base/OTP-15503/PR-2052' into maint
* john/erts/int_to_list_by_base/OTP-15503/PR-2052:
Implement integer_to_list/2 and integer_to_binary/2 as CIFs
Accept base in all integer-printing functions
Diffstat (limited to 'erts/preloaded')
-rw-r--r-- | erts/preloaded/ebin/erlang.beam | bin | 103384 -> 101872 bytes | |||
-rw-r--r-- | erts/preloaded/src/erlang.erl | 55 |
2 files changed, 5 insertions, 50 deletions
diff --git a/erts/preloaded/ebin/erlang.beam b/erts/preloaded/ebin/erlang.beam Binary files differindex 498d437616..0f0c2faa95 100644 --- a/erts/preloaded/ebin/erlang.beam +++ b/erts/preloaded/ebin/erlang.beam diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index f37a3fc5db..c20082a545 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -3395,60 +3395,15 @@ get_cookie() -> -spec integer_to_list(Integer, Base) -> string() when Integer :: integer(), Base :: 2..36. -integer_to_list(I, 10) -> - erlang:integer_to_list(I); -integer_to_list(I, Base) - when erlang:is_integer(I), erlang:is_integer(Base), - Base >= 2, Base =< 1+$Z-$A+10 -> - if I < 0 -> - [$-|integer_to_list(-I, Base, [])]; - true -> - integer_to_list(I, Base, []) - end; -integer_to_list(I, Base) -> - erlang:error(badarg, [I, Base]). - -integer_to_list(I0, Base, R0) -> - D = I0 rem Base, - I1 = I0 div Base, - R1 = if D >= 10 -> - [D-10+$A|R0]; - true -> - [D+$0|R0] - end, - if I1 =:= 0 -> - R1; - true -> - integer_to_list(I1, Base, R1) - end. +integer_to_list(_I, _Base) -> + erlang:nif_error(undefined). -spec integer_to_binary(Integer, Base) -> binary() when Integer :: integer(), Base :: 2..36. -integer_to_binary(I, 10) -> - erlang:integer_to_binary(I); -integer_to_binary(I, Base) - when erlang:is_integer(I), erlang:is_integer(Base), - Base >= 2, Base =< 1+$Z-$A+10 -> - if I < 0 -> - <<$-,(integer_to_binary(-I, Base, <<>>))/binary>>; - true -> - integer_to_binary(I, Base, <<>>) - end; -integer_to_binary(I, Base) -> - erlang:error(badarg, [I, Base]). - -integer_to_binary(I0, Base, R0) -> - D = I0 rem Base, - I1 = I0 div Base, - R1 = if - D >= 10 -> <<(D-10+$A),R0/binary>>; - true -> <<(D+$0),R0/binary>> - end, - if - I1 =:= 0 -> R1; - true -> integer_to_binary(I1, Base, R1) - end. +integer_to_binary(_I, _Base) -> + erlang:nif_error(undefined). + -record(cpu, {node = -1, processor = -1, |