mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 06:06:06 +08:00
From Rob Smart <SMARTROB@uk.ibm.com>
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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user