diff options
author | Kostis Sagonas <[email protected]> | 2015-06-13 15:23:52 +0200 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2015-06-13 15:23:52 +0200 |
commit | 95c318bf220451d5e223dbb166e6c9da4c7d067f (patch) | |
tree | 4e73c12a7b58a12f13d12430b34eecbb912f6a4f | |
parent | 9e67864235e2a9183746dc904f41d03743a77fd2 (diff) | |
download | otp-95c318bf220451d5e223dbb166e6c9da4c7d067f.tar.gz otp-95c318bf220451d5e223dbb166e6c9da4c7d067f.tar.bz2 otp-95c318bf220451d5e223dbb166e6c9da4c7d067f.zip |
Eliminate a dialyzer warning
For quite some time now, this module generated a (quite harmless)
dialyzer warning. Comment out a clause which was actually unreachable.
While at it, do some small code refactorings here and there.
-rw-r--r-- | lib/hipe/rtl/hipe_tagscheme.erl | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lib/hipe/rtl/hipe_tagscheme.erl b/lib/hipe/rtl/hipe_tagscheme.erl index c27c682915..e640a73a6e 100644 --- a/lib/hipe/rtl/hipe_tagscheme.erl +++ b/lib/hipe/rtl/hipe_tagscheme.erl @@ -20,7 +20,7 @@ %%======================================================================== %% %% Filename : hipe_tagscheme.erl -%% Note : This is specific to Erlang 5.* (i.e. starting with R9). +%% Note : This is specific to Erlang >= 5.* (i.e. starting with R9). %% %% Modifications: %% 020904: Happi - added support for external pids and ports. @@ -141,7 +141,7 @@ mk_non_value() -> ?THE_NON_VALUE. -spec is_fixnum(integer()) -> boolean(). is_fixnum(N) when is_integer(N) -> Bits = ?bytes_to_bits(hipe_rtl_arch:word_size()) - ?TAG_IMMED1_SIZE, - (N =< ((1 bsl (Bits - 1)) - 1)) and (N >= -(1 bsl (Bits - 1))). + (N =< ((1 bsl (Bits - 1)) - 1)) andalso (N >= -(1 bsl (Bits - 1))). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -973,11 +973,11 @@ get_one_word_pos_bignum(USize, Size, Fail) -> -spec bignum_sizeneed(non_neg_integer()) -> non_neg_integer(). bignum_sizeneed(Size) -> - WordSizeBits = hipe_rtl_arch:word_size() * 8, case is_fixnum(1 bsl Size) of true -> 0; false -> + WordSizeBits = hipe_rtl_arch:word_size() * 8, ((Size + (WordSizeBits-1)) div WordSizeBits) + 1 end. @@ -1116,14 +1116,11 @@ get_field_offset({matchbuffer, binsize}) -> ?MB_SIZE. get_field_size(Field) -> - size_to_atom(get_field_size1(Field)). - -size_to_atom(Bytes) -> WordSize = hipe_rtl_arch:word_size(), - case Bytes of + case get_field_size1(Field) of WordSize -> word; - 4 -> int32; - %%2 -> int16; So far there are no 2 byte fields + %% 4 -> int32; Seems not needed: covered by the previous case + %% 2 -> int16; So far there are no 2 byte fields 1 -> byte end. |