[erlang-patches] snmp floating bits

Per Hedeland per@REDACTED
Thu Jan 8 00:10:28 CET 2009


Hi,

There is a quite unnecessary use of math:pow/2 in snmpa_agent.erl, that
may (did:-) cause problems on systems without floating point support.
Obvious patch below.

--Per Hedeland

--- lib/snmp/src/agent/snmpa_agent.erl.orig	2008-06-10 14:55:27.000000000 +0200
+++ lib/snmp/src/agent/snmpa_agent.erl	2009-01-08 00:00:36.000000000 +0100
@@ -2940,7 +2940,7 @@
   when Asn1#asn1_type.bertype == 'BITS', integer(Val) ->
     {value,Kibbles} = snmp_misc:assq(kibbles,Asn1#asn1_type.assocList),
     {_Kibble,BitNo} = lists:last(Kibbles),
-    case round(math:pow(2,BitNo+1)) of
+    case (1 bsl (BitNo+1)) of
 	X when Val < X ->
 	    {value,'BITS',Val};
 	_Big ->



More information about the erlang-patches mailing list