From d76f0437cdb80cc40082885008fc79bfac435334 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 11 Apr 2025 20:19:49 +0100 Subject: [PATCH] ugly cosmetics --- .../Shared/Api/Implementation/LSL_Api.cs | 28 +++++++++++-------- .../Shared/Api/Implementation/OSSL_Api.cs | 17 ++++++----- .../Region/ScriptEngine/Shared/LSL_Types.cs | 13 ++++++++- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 832ada729c..fb270f07db 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6558,15 +6558,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// The index number of the point in src where test was found if it was found. /// Otherwise returns -1 /// - public LSL_Integer llListFindList(LSL_List src, LSL_List test) + public LSL_Integer llListFindList(LSL_List lsrc, LSL_List ltest) { - if (src.Length == 0) + if (lsrc.Length == 0) return -1; - if (test.Length == 0) + if (ltest.Length == 0) return 0; - if (test.Length > src.Length) + if (ltest.Length > lsrc.Length) return -1; + object[] src = lsrc.Data; + object[] test = ltest.Data; + object test0 = test[0]; for (int i = 0; i <= src.Length - test.Length; i++) { @@ -6589,24 +6592,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return -1; } - public LSL_Integer llListFindListNext(LSL_List src, LSL_List test, LSL_Integer linstance) + public LSL_Integer llListFindListNext(LSL_List lsrc, LSL_List ltest, LSL_Integer linstance) { - if (src.Length == 0) - return test.Length == 0 ? 0 : -1; + if (lsrc.Length == 0) + return ltest.Length == 0 ? 0 : -1; int instance = linstance.value; - if (test.Length == 0) + if (ltest.Length == 0) { if(instance >= 0) - return instance < src.Length ? instance : -1; + return instance < lsrc.Length ? instance : -1; - instance += src.Length; + instance += lsrc.Length; return instance >= 0 ? instance : -1; } - if (test.Length > src.Length) + if (ltest.Length > lsrc.Length) return -1; + object[] src = lsrc.Data; + object[] test = ltest.Data; + object test0 = test[0]; int nmatchs = 0; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5269d1baf5..6583231adc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -6640,24 +6640,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return new LSL_Vector(red, green, 1.0f); } - public LSL_Integer osListFindListNext(LSL_List src, LSL_List test, LSL_Integer lstart, LSL_Integer lend, LSL_Integer linstance) + public LSL_Integer osListFindListNext(LSL_List lsrc, LSL_List ltest, LSL_Integer lstart, LSL_Integer lend, LSL_Integer linstance) { - if (src.Length == 0) - return test.Length == 0 ? 0 : -1; + if (lsrc.Length == 0) + return ltest.Length == 0 ? 0 : -1; int instance = linstance.value; - if (test.Length == 0) + if (ltest.Length == 0) { if(instance >= 0) - return instance < src.Length ? instance : -1; + return instance < lsrc.Length ? instance : -1; - instance += src.Length; + instance += lsrc.Length; return instance >= 0 ? instance : -1; } - if (test.Length > src.Length) + if (ltest.Length > lsrc.Length) return -1; + object[] src = lsrc.Data; + object[] test = ltest.Data; + int start = lstart.value; if (start < 0) { diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 6d557ba87d..be822b3fe3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -802,6 +802,7 @@ namespace OpenSim.Region.ScriptEngine.Shared public int Length { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { if (m_data is null) @@ -860,12 +861,13 @@ namespace OpenSim.Region.ScriptEngine.Shared public object[] Data { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { m_data ??= new object[0]; return m_data; } - + [MethodImpl(MethodImplOptions.AggressiveInlining)] set { m_data = value; } } @@ -878,6 +880,7 @@ namespace OpenSim.Region.ScriptEngine.Shared /// /// /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public Type GetLSLListItemType(int itemIndex) { return Data[itemIndex].GetType(); @@ -1105,6 +1108,7 @@ namespace OpenSim.Region.ScriptEngine.Shared Data[itemIndex].GetType().Name : "null")); } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public LSL_Types.key GetKeyItem(int itemIndex) { return (LSL_Types.key)Data[itemIndex]; @@ -1137,12 +1141,14 @@ namespace OpenSim.Region.ScriptEngine.Shared public object this[int i] { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { if(m_data is null || i >= m_data.Length) return null; return m_data[i]; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] set { if (m_data is null || i >= m_data.Length) @@ -1151,6 +1157,7 @@ namespace OpenSim.Region.ScriptEngine.Shared } } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator Boolean(list l) { return l.Length != 0; @@ -1174,6 +1181,7 @@ namespace OpenSim.Region.ScriptEngine.Shared return a; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator ==(list a, list b) { if (b is null) @@ -1181,6 +1189,7 @@ namespace OpenSim.Region.ScriptEngine.Shared return a is not null && a.Length == b.Length; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool operator !=(list a, list b) { if (b is null) @@ -2233,6 +2242,7 @@ namespace OpenSim.Region.ScriptEngine.Shared } } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public override bool Equals(object o) { if (o is list lo) @@ -2240,6 +2250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared return false; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public override int GetHashCode() { return Data.GetHashCode();