MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / IsBlittable

Method IsBlittable

Source/Engine/Engine/NativeInterop.cs:306–326  ·  view source on GitHub ↗
(Type type)

Source from the content-addressed store, hash-verified

304 }
305
306 internal static bool IsBlittable(Type type)
307 {
308 if (type.IsPrimitive || type.IsEnum)
309 return true;
310 if (type.IsArray && IsBlittable(type.GetElementType()))
311 return true;
312 if (type.IsPointer && type.HasElementType && type.GetElementType().IsPrimitive)
313 return true;
314 if (type.IsClass)
315 return false;
316 if (type.IsValueType)
317 {
318 var fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
319 foreach (FieldInfo field in fields)
320 {
321 if (!IsBlittable(field.FieldType))
322 return false;
323 }
324 }
325 return true;
326 }
327
328 /// <summary>
329 /// Returns blittable internal type for given type.

Callers

nothing calls this directly

Calls 2

GetElementTypeMethod · 0.45
GetFieldsMethod · 0.45

Tested by

no test coverage detected