public static ulong GenerateStableValueForMathOp(MathOperationsMetaData.MathOps mathOp, ValueType returnType, ValueType[] paramTypes) { uint signature = GenerateSignatureFlag(returnType, paramTypes); uint op = (uint)mathOp; Assert.AreNotEqual((op & k_IsCustomOpBit), k_IsCustomOpBit, $"Op {mathOp} uses the {nameof(k_IsCustomOpBit)} bit"); 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; } }