summaryrefslogtreecommitdiff
path: root/lib/stdlib/src/queue.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stdlib/src/queue.erl')
-rw-r--r--lib/stdlib/src/queue.erl12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/stdlib/src/queue.erl b/lib/stdlib/src/queue.erl
index 67ea0f8be4..a71121ad2d 100644
--- a/lib/stdlib/src/queue.erl
+++ b/lib/stdlib/src/queue.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2021. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2022. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -703,11 +703,11 @@ r2f([]) ->
{[],[]};
r2f([_]=R) ->
{[],R};
-r2f([X,Y]) ->
- {[X],[Y]};
+r2f([Y,X]) ->
+ {[Y],[X]};
r2f(List) ->
- {FF,RR} = lists:split(length(List) div 2 + 1, List),
- {FF,lists:reverse(RR, [])}.
+ {RR,FF} = lists:split(length(List) div 2, List),
+ {RR,lists:reverse(FF, [])}.
%% Move half of elements from F to R, if there are enough
f2r([]) ->
@@ -717,5 +717,5 @@ f2r([_]=F) ->
f2r([X,Y]) ->
{[Y],[X]};
f2r(List) ->
- {FF,RR} = lists:split(length(List) div 2 + 1, List),
+ {FF,RR} = lists:split(length(List) div 2, List),
{lists:reverse(RR, []),FF}.