1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2006-2016. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20-module(otp_6121). 21-export([?MODULE/0]). 22 23?MODULE() -> 24 42 = digit_map_timer(<<1>>, 42), 25 test(), 26 Beam = code:which(?MODULE), 27 Sz = filelib:file_size(Beam), 28 io:format("Size of Beam file: ~p\n", [Sz]), 29 if 30 100 < Sz, Sz < 100000 -> 31 ok 32 end. 33 34test() -> 35 %% Make sure that the compiler does not make an unreasonable 36 %% expansion when trying to optimize the following expressions. 37 <<0:(8*128*1024)>> = id(<<0:(8*128*1024)>>), 38 <<100:(8*128*1024)>> = id(<<100:(8*128*1024)>>), 39 <<1009797879398749873879789879388:(8*128*1024)>> = 40 id(<<1009797879398749873879789879388:(8*128*1024)>>), 41 <<7:(8*128*1024)/little>> = id(<<7:(8*128*1024)/little>>), 42 ok. 43 44id(I) -> I. 45 46digit_map_timer(<<_:8>>, Int) when is_integer(Int) andalso Int >= 0 -> 47 Int; 48digit_map_timer(_, _) -> 49 error. 50