1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
%%% -*- erlang-indent-level: 2 -*-
%%%-------------------------------------------------------------------
%%% File : bs_system_limit_32.erl
%%% Author : Per Gustafsson <[email protected]>
%%% Purpose : Checks binary system limits on 32-bit machines
%%% Created : 14 May 2008
%%%-------------------------------------------------------------------
-module(bs_system_limit_32).
-export([test/0]).
test() ->
case erlang:system_info(wordsize) of
4 -> system_limit_32();
8 -> ok
end.
system_limit_32() ->
{'EXIT', {badarg, _}} = (catch <<42:(id(-1))>>),
{'EXIT', {badarg, _}} = (catch <<42:(id(-389739873536870912))/unit:8>>),
{'EXIT', {system_limit, _}} = (catch <<32:536870912/unit:8>>),
{'EXIT', {system_limit, _}} = (catch <<42:(id(536870912))/unit:8>>),
{'EXIT', {system_limit, _}} = (catch <<42:(id(536870912))/unit:8,1:1>>),
ok.
id(X) -> X.
|