diff options
author | Björn Gustavsson <[email protected]> | 2017-09-01 10:44:41 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-09-01 10:44:41 +0200 |
commit | 2ddc4f3808e9139ca9826c04d0f2829d3bf50b84 (patch) | |
tree | e9d266d04a55f0511ed98dd0cb9b2c9844879a5a /lib/compiler/test | |
parent | 2d32a4d56c2e2bf9aeb3593efca5a2f9d8419d97 (diff) | |
parent | 00c13ed24a08799ba938a64e3198e75f07329486 (diff) | |
download | otp-2ddc4f3808e9139ca9826c04d0f2829d3bf50b84.tar.gz otp-2ddc4f3808e9139ca9826c04d0f2829d3bf50b84.tar.bz2 otp-2ddc4f3808e9139ca9826c04d0f2829d3bf50b84.zip |
Merge pull request #1554 from bjorng/bjorn/compiler/opt-bsm/ERL-444
Eliminate unnecessary 'move' instructions
OTP-14594
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/bs_match_SUITE.erl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl index 0ec05456ec..1da7f68dab 100644 --- a/lib/compiler/test/bs_match_SUITE.erl +++ b/lib/compiler/test/bs_match_SUITE.erl @@ -39,7 +39,7 @@ match_string_opt/1,select_on_integer/1, map_and_binary/1,unsafe_branch_caching/1, bad_literals/1,good_literals/1,constant_propagation/1, - parse_xml/1,get_payload/1]). + parse_xml/1,get_payload/1,escape/1]). -export([coverage_id/1,coverage_external_ignore/2]). @@ -71,7 +71,7 @@ groups() -> match_string_opt,select_on_integer, map_and_binary,unsafe_branch_caching, bad_literals,good_literals,constant_propagation,parse_xml, - get_payload]}]. + get_payload,escape]}]. init_per_suite(Config) -> @@ -1524,6 +1524,21 @@ do_get_payload(ExtHdr) -> <<_:13,_:35>> = ExtHdr#ext_header.ext_hdr_opts, ExtHdrOptions. +escape(_Config) -> + 0 = escape(<<>>, 0), + 1 = escape(<<128>>, 0), + 2 = escape(<<128,255>>, 0), + 42 = escape(<<42>>, 0), + 50 = escape(<<42,8>>, 0), + ok. + +escape(<<Byte, Rest/bits>>, Pos) when Byte >= 127 -> + escape(Rest, Pos + 1); +escape(<<Byte, Rest/bits>>, Pos) -> + escape(Rest, Pos + Byte); +escape(<<_Rest/bits>>, Pos) -> + Pos. + check(F, R) -> R = F(). |