/// <summary>
 /// Gets the default value for any value of the given type.
 /// </summary>
 private static object GetDefaultValue(Mono.Cecil.TypeReference type)
 {
     if (type.IsByte()) return (byte)0;
     if (type.IsSByte()) return (sbyte)0;
     if (type.IsBoolean()) return false;
     if (type.IsChar()) return '\0';
     if (type.IsInt16()) return (short)0;
     if (type.IsInt32()) return 0;
     if (type.IsInt64()) return 0L;
     if (type.IsFloat()) return 0.0F;
     if (type.IsDouble()) return 0.0;
     return null;
 }
예제 #2
0
 private string GetAtomicFieldUpdaterType(Mono.Cecil.TypeReference fieldType)
 {
     if (fieldType.IsInt64())
         return "AtomicLongFieldUpdater`1";
     if (fieldType.IsInt32())
         return "AtomicIntegerFieldUpdater`1";
     if (fieldType.IsPrimitive)
         return null;
     return "AtomicReferenceFieldUpdater`2";
 }