From ac6657d0f1522d3f23c8b3cb3a652e467aee7275 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 10 Feb 2009 13:36:42 +0000 Subject: From Rob Smart In SL if llAbs() is called with the minimum integer value of -2147483648 it will return that value untouched without error. this patch replicates the SL functionality. OpenSim currently throws an overflow exception: number too small under mono or a "System.OverflowException: Negating the minimum value of a twos complement number is invalid. " under .NET --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/Api') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d1006e3..c2449a2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -361,8 +361,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Integer llAbs(int i) { + // changed to replicate LSL behaviour whereby minimum int value is returned untouched. m_host.AddScriptLPS(1); - return (int)Math.Abs(i); + if(i == Int32.MinValue) + return i; + else + return (int)Math.Abs(i); } public LSL_Float llFabs(double f) -- cgit v1.1