From 8498cc2f02ef61e93d603dac28c21df4321609a1 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 1 May 2017 23:07:57 +0100 Subject: [PATCH] save a few nanoseconds --- .../Scenes/SceneObjectPartInventory.cs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 946ed09b9f..8c9d0bb4e3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -1351,19 +1351,26 @@ namespace OpenSim.Region.Framework.Scenes if(item.InvType == (sbyte)InventoryType.Landmark) continue; - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) - mask &= ~((uint)PermissionMask.FoldedCopy); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) + // apply current to normal permission bits + uint newperms = item.CurrentPermissions; + + if ((newperms & (uint)PermissionMask.Copy) == 0) + mask &= ~(uint)PermissionMask.Copy; + if ((newperms & (uint)PermissionMask.Transfer) == 0) + mask &= ~(uint)PermissionMask.Transfer; + if ((newperms & (uint)PermissionMask.Export) == 0) + mask &= ~((uint)PermissionMask.Export); + + // apply next owner restricted by current to folded bits + newperms &= item.NextPermissions; + + if ((newperms & (uint)PermissionMask.Copy) == 0) + mask &= ~((uint)PermissionMask.FoldedCopy); + if ((newperms & (uint)PermissionMask.Transfer) == 0) mask &= ~((uint)PermissionMask.FoldedTransfer); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Export) == 0) + if ((newperms & (uint)PermissionMask.Export) == 0) mask &= ~((uint)PermissionMask.FoldedExport); - if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) - mask &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) - mask &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & (uint)PermissionMask.Export) == 0) - mask &= ~((uint)PermissionMask.Export); } return mask; }