+
+ internal static uint SizeOfType (Type type)
+ {
+ return (uint) SizeOf (type);
+ }
+
+ internal static uint AlignedSizeOf<T> () where T : struct
+ {
+ uint size = SizeOfType (typeof (T));
+ if (size == 1 || size == 2)
+ return size;
+ if (IntPtr.Size == 8 && size == 4)
+ return size;
+ return (size + 3) & (~((uint)3));
+ }