C# Класс ABT.TypeCast

Наследование: Expr
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
Expr Expr
Kind TypeCastType

Открытые методы

Метод Описание
CGenAddress ( CGenState state ) : void
CGenValue ( CGenState state ) : System.Reg
EqualType ( ExprType t1, ExprType t2 ) : System.Boolean
FloatToArith ( Expr expr, ExprType type ) : Expr

From: float, double To: char, uchar, short, ushort, long, ulong, float, double

According to MSDN "Conversions from Floating-Point Types", float cannot convert to unsigned char. I don't know why, but I follow it.

FromPointer ( Expr expr, ExprType type, Env env ) : Expr

From: pointer To: pointer, integral

IntegralPromotion ( Expr expr ) : ExprTypeKind>.Tuple

All integrals are converted to LongType or ULongType.

MakeCast ( Expr expr, ExprType type ) : Expr
MakeCast ( Expr expr, ExprType type, Env env ) : Expr
SignedIntegralToArith ( Expr expr, ExprType type ) : Expr

From: char, short, long To: char, uchar, short, ushort, long, ulong, float double

ToPointer ( Expr expr, ExprType type, Env env ) : Expr

From: pointer, integral To: pointer

TypeCast ( TypeCastType kind, Expr expr, ExprType type ) : System
UnsignedIntegralToArith ( Expr expr, ExprType type ) : Expr

From: uchar, ushort, ulong To: char, uchar, short, ushort, long, ulong, float, double

Aaccording to MSDN "Conversions from Unsigned Integral Types", unsigned long converts directly to double. However, I just treat unsigned long as long.

UsualArithmeticConversion ( Expr e1, Expr e2 ) : Tuple

Perform the usual arithmetic conversion on two expressions.

If either expression is DoubleType, then both are converted to DoubleType.

Else, if either expression is FloatType, then both are converted to FloatType.

Else, if either expression is ULongType, then both are converted to ULongType.

Else, both are converted to LongType.

UsualScalarConversion ( Expr e1, Expr e2 ) : Tuple

First, convert pointers to ULongType's, then do UsualArithmeticConversion.

Приватные методы

Метод Описание
TypeCast ( TypeCastType kind, Expr expr, ExprType type, Env env ) : System

Описание методов

CGenAddress() публичный метод

public CGenAddress ( CGenState state ) : void
state CodeGeneration.CGenState
Результат void

CGenValue() публичный метод

public CGenValue ( CGenState state ) : System.Reg
state CodeGeneration.CGenState
Результат System.Reg

EqualType() публичный статический метод

public static EqualType ( ExprType t1, ExprType t2 ) : System.Boolean
t1 ExprType
t2 ExprType
Результат System.Boolean

FloatToArith() публичный статический метод

From: float, double To: char, uchar, short, ushort, long, ulong, float, double
According to MSDN "Conversions from Floating-Point Types", float cannot convert to unsigned char. I don't know why, but I follow it.
public static FloatToArith ( Expr expr, ExprType type ) : Expr
expr Expr
type ExprType
Результат Expr

FromPointer() публичный статический метод

From: pointer To: pointer, integral
public static FromPointer ( Expr expr, ExprType type, Env env ) : Expr
expr Expr
type ExprType
env Env
Результат Expr

IntegralPromotion() публичный статический метод

All integrals are converted to LongType or ULongType.
public static IntegralPromotion ( Expr expr ) : ExprTypeKind>.Tuple
expr Expr /// The integral expression to be casted. ///
Результат ExprTypeKind>.Tuple

MakeCast() публичный статический метод

public static MakeCast ( Expr expr, ExprType type ) : Expr
expr Expr
type ExprType
Результат Expr

MakeCast() публичный статический метод

public static MakeCast ( Expr expr, ExprType type, Env env ) : Expr
expr Expr
type ExprType
env Env
Результат Expr

SignedIntegralToArith() публичный статический метод

From: char, short, long To: char, uchar, short, ushort, long, ulong, float double
public static SignedIntegralToArith ( Expr expr, ExprType type ) : Expr
expr Expr
type ExprType
Результат Expr

ToPointer() публичный статический метод

From: pointer, integral To: pointer
public static ToPointer ( Expr expr, ExprType type, Env env ) : Expr
expr Expr
type ExprType
env Env
Результат Expr

TypeCast() публичный метод

public TypeCast ( TypeCastType kind, Expr expr, ExprType type ) : System
kind TypeCastType
expr Expr
type ExprType
Результат System

UnsignedIntegralToArith() публичный статический метод

From: uchar, ushort, ulong To: char, uchar, short, ushort, long, ulong, float, double
Aaccording to MSDN "Conversions from Unsigned Integral Types", unsigned long converts directly to double. However, I just treat unsigned long as long.
public static UnsignedIntegralToArith ( Expr expr, ExprType type ) : Expr
expr Expr
type ExprType
Результат Expr

UsualArithmeticConversion() публичный статический метод

Perform the usual arithmetic conversion on two expressions.

If either expression is DoubleType, then both are converted to DoubleType.

Else, if either expression is FloatType, then both are converted to FloatType.

Else, if either expression is ULongType, then both are converted to ULongType.

Else, both are converted to LongType.

public static UsualArithmeticConversion ( Expr e1, Expr e2 ) : Tuple
e1 Expr The first expression to be casted. Must have .
e2 Expr The second expression to be casted. Must have .
Результат Tuple

UsualScalarConversion() публичный статический метод

First, convert pointers to ULongType's, then do UsualArithmeticConversion.
public static UsualScalarConversion ( Expr e1, Expr e2 ) : Tuple
e1 Expr /// The first expression to be casted. ///
e2 Expr /// The second expression to be casted. ///
Результат Tuple

Описание свойств

Expr публичное свойство

public Expr,ABT Expr
Результат Expr

Kind публичное свойство

public TypeCastType Kind
Результат TypeCastType