internal static ulong GenerateStableValueForCustomOp(MathOperationsMetaData.CustomOps customOp, Runtime.ValueType returnType, Runtime.ValueType[] paramTypes) { uint signature = GenerateSignatureFlag(returnType, paramTypes); uint op = (uint)customOp; Assert.AreNotEqual((op & k_IsCustomOpBit), k_IsCustomOpBit, $"Op {customOp} uses the {nameof(k_IsCustomOpBit)} bit"); op |= k_IsCustomOpBit; ulong result = ((ulong)signature << 32) | op; return(result); }
private static void OpFromStableUlong(ulong value, out bool isCustomOp, out MathOperationsMetaData.CustomOps customOps, out MathOperationsMetaData.MathOps mathOps, out uint signature) { uint opPart = (uint)(value & 0x00000000_FFFFFFFF); signature = (uint)((value & 0xFFFFFFFF_00000000) >> 32); isCustomOp = (opPart & k_IsCustomOpBit) == k_IsCustomOpBit; var op = opPart & ~k_IsCustomOpBit; if (isCustomOp) { customOps = (MathOperationsMetaData.CustomOps)op; mathOps = MathOperationsMetaData.MathOps.None; } else { customOps = MathOperationsMetaData.CustomOps.None; mathOps = (MathOperationsMetaData.MathOps)op; } }