Exemplo n.º 1
0
 /// <summary>
 /// Creates a cast operation that casts a pointer into an integer.
 /// </summary>
 /// <param name="location">The current location.</param>
 /// <param name="node">The operand.</param>
 /// <param name="targetType">The target integer type.</param>
 /// <returns>A node that represents the cast operation.</returns>
 public ValueReference CreatePointerAsIntCast(
     Location location,
     Value node,
     BasicValueType targetType)
 {
     location.Assert(node.Type.IsPointerType && targetType.IsInt());
     return(Append(new PointerAsIntCast(
                       GetInitializer(location),
                       node,
                       GetPrimitiveType(targetType))));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Returns true iff the given basic-value type represents either a ptr or an int.
 /// </summary>
 /// <param name="value">The basic-value type.</param>
 /// <returns>True, iff the given basic-value type represents either a ptr or an int.</returns>
 public static bool IsPtrOrInt(this BasicValueType value)
 {
     return(value == BasicValueType.Ptr || value.IsInt());
 }