本文整理汇总了C#中MosaType.GetPrimitiveSize方法的典型用法代码示例。如果您正苦于以下问题:C# MosaType.GetPrimitiveSize方法的具体用法?C# MosaType.GetPrimitiveSize怎么用?C# MosaType.GetPrimitiveSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MosaType
的用法示例。
在下文中一共展示了MosaType.GetPrimitiveSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsCompoundType
public bool IsCompoundType(MosaType type)
{
// i.e. whether copying of the type requires multiple move
int? primitiveSize = type.GetPrimitiveSize(nativePointerSize);
if (primitiveSize != null && primitiveSize > 8)
return true;
if (!type.IsUserValueType)
return false;
int typeSize = GetTypeSize(type);
if (typeSize > nativePointerSize)
return true;
return false;
}
示例2: ResolveType
private void ResolveType(MosaType type)
{
if (type.IsModule)
return;
if (type.HasOpenGenericParams)
return;
if (type.BaseType == null && !type.IsInterface && type.FullName != "System.Object") // ghost types like generic params, function ptr, etc.
return;
if (typeSet.Contains(type))
return;
typeSet.Add(type);
if (type.BaseType != null)
{
ResolveType(type.BaseType);
}
if (type.IsInterface)
{
ResolveInterfaceType(type);
CreateMethodTable(type);
return;
}
foreach (MosaType interfaceType in type.Interfaces)
{
ResolveInterfaceType(interfaceType);
}
int? size = type.GetPrimitiveSize((int)nativePointerSize);
if (size != null)
{
typeSizes[type] = size.Value;
}
else if (type.IsExplicitLayout)
{
ComputeExplicitLayout(type);
}
else
{
ComputeSequentialLayout(type);
}
CreateMethodTable(type);
}
示例3: ResolveType
private void ResolveType(MosaType type)
{
if (type.IsModule)
return;
if (type.BaseType == null && !type.IsInterface && type.FullName != "System.Object") // ghost types like generic params, function ptr, etc.
return;
if (type.Modifier != null) // For types having modifiers, resolve the element type instead.
{
ResolveType(type.ElementType);
return;
}
// FIXME: This is not threadsafe!!!!!
if (typeSet.Contains(type))
return;
typeSet.Add(type);
if (type.BaseType != null)
{
ResolveType(type.BaseType);
}
if (type.IsInterface)
{
ResolveInterfaceType(type);
CreateMethodTable(type);
return;
}
foreach (var interfaceType in type.Interfaces)
{
ResolveInterfaceType(interfaceType);
}
int? size = type.GetPrimitiveSize(NativePointerSize);
if (size != null)
{
typeSizes[type] = size.Value;
}
else if (type.IsExplicitLayout)
{
ComputeExplicitLayout(type);
}
else
{
ComputeSequentialLayout(type);
}
CreateMethodTable(type);
}