aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2014-06-30 13:44:12 +0200
committerHans Bolinder <[email protected]>2014-06-30 13:44:12 +0200
commita594da7662a70aa6e240cb2bfaf6728df831a542 (patch)
treec62201be9d7143e020d0427a4ab7be8fddaa4c88 /lib/hipe
parenta7f2bce6e2e5486ccdb217b46b32a407cb526706 (diff)
parenta884f78ee7609b3140f5a9fb524599be4ea816d7 (diff)
downloadotp-a594da7662a70aa6e240cb2bfaf6728df831a542.tar.gz
otp-a594da7662a70aa6e240cb2bfaf6728df831a542.tar.bz2
otp-a594da7662a70aa6e240cb2bfaf6728df831a542.zip
Merge branch 'maint'
* maint: hipe: Correct pretty-printing of bitstrings
Diffstat (limited to 'lib/hipe')
-rw-r--r--lib/hipe/cerl/cerl_prettypr.erl17
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/hipe/cerl/cerl_prettypr.erl b/lib/hipe/cerl/cerl_prettypr.erl
index 9a3873f46d..f4a67439d6 100644
--- a/lib/hipe/cerl/cerl_prettypr.erl
+++ b/lib/hipe/cerl/cerl_prettypr.erl
@@ -1,7 +1,7 @@
%% =====================================================================
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2009. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2014. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -476,13 +476,20 @@ lay_literal(Node, Ctxt) ->
%% that could represent printable characters - we
%% always print an integer.
text(int_lit(Node));
- V when is_binary(V) ->
- lay_binary(c_binary([c_bitstr(abstract(B),
- abstract(8),
+ V when is_bitstring(V) ->
+ Val = fun(I) when is_integer(I) -> I;
+ (B) when is_bitstring(B) ->
+ BZ = bit_size(B), <<BV:BZ>> = B, BV
+ end,
+ Sz = fun(I) when is_integer(I) -> 8;
+ (B) when is_bitstring(B) -> bit_size(B)
+ end,
+ lay_binary(c_binary([c_bitstr(abstract(Val(B)),
+ abstract(Sz(B)),
abstract(1),
abstract(integer),
abstract([unsigned, big]))
- || B <- binary_to_list(V)]),
+ || B <- bitstring_to_list(V)]),
Ctxt);
[] ->
text("[]");