diff options
author | Björn Gustavsson <[email protected]> | 2016-08-10 10:09:56 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-08-10 10:09:56 +0200 |
commit | 73d9d1d3adabce8636a0010d6fdb6be37c36cae2 (patch) | |
tree | ec1093d5760cdeb2f03a9929f355515dd5106af2 /lib/stdlib | |
parent | 3dc416bb89e577c83e16c306fd4821da03681ab9 (diff) | |
parent | a5fcd4f26969a768950dc643eeed2fdb41a5dc41 (diff) | |
download | otp-73d9d1d3adabce8636a0010d6fdb6be37c36cae2.tar.gz otp-73d9d1d3adabce8636a0010d6fdb6be37c36cae2.tar.bz2 otp-73d9d1d3adabce8636a0010d6fdb6be37c36cae2.zip |
Merge branch 'josevalim/large-binary-strings/PR-1131/OTP-13794'
* josevalim/large-binary-strings/PR-1131/OTP-13794:
Move expansion of strings in binaries to v3_core
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/src/eval_bits.erl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/stdlib/src/eval_bits.erl b/lib/stdlib/src/eval_bits.erl index 80667023fb..631faa3be5 100644 --- a/lib/stdlib/src/eval_bits.erl +++ b/lib/stdlib/src/eval_bits.erl @@ -67,16 +67,20 @@ expr_grp([Field | FS], Bs0, Lf, Acc) -> expr_grp([], Bs0, _Lf, Acc) -> {value,Acc,Bs0}. +eval_field({bin_element, _, {string, _, S}, {integer,_,8}, [integer,{unit,1},unsigned,big]}, Bs0, _Fun) -> + Latin1 = [C band 16#FF || C <- S], + {list_to_binary(Latin1),Bs0}; eval_field({bin_element, _, {string, _, S}, default, default}, Bs0, _Fun) -> Latin1 = [C band 16#FF || C <- S], {list_to_binary(Latin1),Bs0}; -eval_field({bin_element, Line, {string, _, S}, Size0, Options0}, Bs, _Fun) -> - {_Size,[Type,_Unit,_Sign,Endian]} = +eval_field({bin_element, Line, {string, _, S}, Size0, Options0}, Bs0, Fun) -> + {Size1,[Type,{unit,Unit},Sign,Endian]} = make_bit_type(Line, Size0, Options0), - Res = << <<(eval_exp_field1(C, no_size, no_unit, - Type, Endian, no_sign))/binary>> || + {value,Size,Bs1} = Fun(Size1, Bs0), + Res = << <<(eval_exp_field1(C, Size, Unit, + Type, Endian, Sign))/binary>> || C <- S >>, - {Res,Bs}; + {Res,Bs1}; eval_field({bin_element,Line,E,Size0,Options0}, Bs0, Fun) -> {value,V,Bs1} = Fun(E, Bs0), {Size1,[Type,{unit,Unit},Sign,Endian]} = |