static uint GenerateSignatureFlag(Runtime.ValueType returnType, Runtime.ValueType[] paramTypes) { uint sig = 0u; sig |= (byte)returnType; UnityEngine.Assertions.Assert.IsTrue(paramTypes.Length <= 7); // (7 params + 1 return type) * 4 bits = 32bits for (int i = 0; i < paramTypes.Length; i++) { sig |= (uint)((byte)paramTypes[i]) << (4 * (i + 1)); } return(sig); }
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); }