Mosa.Compiler.Framework.MosaTypeLayout.GetTypeSize C# (CSharp) Method

GetTypeSize() public method

Gets the size of the type.
public GetTypeSize ( MosaType type ) : int
type MosaType The type.
return int
        public int GetTypeSize(MosaType type)
        {
            ResolveType(type);

            var size = 0;
            typeSizes.TryGetValue(type, out size);

            return size;
        }

Usage Example

Beispiel #1
0
 /// <summary>
 /// Gets the type memory requirements.
 /// </summary>
 /// <param name="typeLayout">The type layouts.</param>
 /// <param name="type">The signature type.</param>
 /// <param name="size">Receives the memory size of the type.</param>
 /// <param name="alignment">Receives alignment requirements of the type.</param>
 public override void GetTypeRequirements(MosaTypeLayout typeLayout, MosaType type, out int size, out int alignment)
 {
     if (type.IsUI8 || type.IsR8 || !type.IsValueType || type.IsPointer)
     {
         size = 8;
         alignment = 8;
     }
     else if (typeLayout.IsCompoundType(type))
     {
         size = typeLayout.GetTypeSize(type);
         alignment = 8;
     }
     else
     {
         size = 4;
         alignment = 4;
     }
 }
All Usage Examples Of Mosa.Compiler.Framework.MosaTypeLayout::GetTypeSize