Ejemplo n.º 1
0
 public static void Main(string[] args)
 {
     for (nuint i = 0; i < (nuint)2; i++)
     {
         System.Console.WriteLine(i);
     }
 }
Ejemplo n.º 2
0
 public MPMediaQuerySection GetSection(xint index)
 {
     using (var array = new NSArray (Messaging.IntPtr_objc_msgSend (Handle, Selector.GetHandle ("itemSections"))))
         return array.GetItem<MPMediaQuerySection> (index);
 }
Ejemplo n.º 3
0
 public MPMediaItem GetItem(xint index)
 {
     using (var array = new NSArray (Messaging.IntPtr_objc_msgSend (Handle, Selector.GetHandle ("items"))))
         return array.GetItem<MPMediaItem> (index);
 }
Ejemplo n.º 4
0
 public UrhoString(System.nuint value)
 {
     Runtime.Validate(typeof(UrhoString));
     handle = UrhoString_String7(value);
     OnUrhoStringCreated();
 }
Ejemplo n.º 5
0
 internal static extern IntPtr UrhoString_String7(System.nuint value);
Ejemplo n.º 6
0
        private static bool TryConvertFromTruncating <TOther>(TOther value, out ushort result)
            where TOther : INumberBase <TOther>
        {
            // In order to reduce overall code duplication and improve the inlinabilty of these
            // methods for the corelib types we have `ConvertFrom` handle the same sign and
            // `ConvertTo` handle the opposite sign. However, since there is an uneven split
            // between signed and unsigned types, the one that handles unsigned will also
            // handle `Decimal`.
            //
            // That is, `ConvertFrom` for `ushort` will handle the other unsigned types and
            // `ConvertTo` will handle the signed types

            if (typeof(TOther) == typeof(byte))
            {
                byte actualValue = (byte)(object)value;
                result = actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(char))
            {
                char actualValue = (char)(object)value;
                result = actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(decimal))
            {
                decimal actualValue = (decimal)(object)value;
                result = (actualValue >= MaxValue) ? MaxValue :
                         (actualValue <= MinValue) ? MinValue : (ushort)actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(uint))
            {
                uint actualValue = (uint)(object)value;
                result = (ushort)actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(ulong))
            {
                ulong actualValue = (ulong)(object)value;
                result = (ushort)actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(UInt128))
            {
                UInt128 actualValue = (UInt128)(object)value;
                result = (ushort)actualValue;
                return(true);
            }
            else if (typeof(TOther) == typeof(nuint))
            {
                nuint actualValue = (nuint)(object)value;
                result = (ushort)actualValue;
                return(true);
            }
            else
            {
                result = default;
                return(false);
            }
        }
Ejemplo n.º 7
0
 public unsafe nuint PreRealloc(void *pRequest, nuint cbRequest, void **ppNewRequest, BOOL fSpyed)
 => CurrentSpy?.PreRealloc(pRequest, cbRequest, ppNewRequest, fSpyed) ?? cbRequest;
Ejemplo n.º 8
0
 private static extern unsafe void __Memmove(byte *dest, byte *src, nuint len);
Ejemplo n.º 9
0
 internal static void BulkMoveWithWriteBarrier(ref byte dmem, ref byte smem, nuint size)
 => RuntimeImports.RhBulkMoveWithWriteBarrier(ref dmem, ref smem, size);
Ejemplo n.º 10
0
        private static void _BulkMoveWithWriteBarrier(ref byte destination, ref byte source, nuint byteCount)
        {
            Debug.Assert(byteCount > BulkMoveWithWriteBarrierChunk);

            if (Unsafe.AreSame(ref source, ref destination))
            {
                return;
            }

            // This is equivalent to: (destination - source) >= byteCount || (destination - source) < 0
            if ((nuint)(nint)Unsafe.ByteOffset(ref source, ref destination) >= byteCount)
            {
                // Copy forwards
                do
                {
                    byteCount -= BulkMoveWithWriteBarrierChunk;
                    __BulkMoveWithWriteBarrier(ref destination, ref source, BulkMoveWithWriteBarrierChunk);
                    destination = ref Unsafe.AddByteOffset(ref destination, BulkMoveWithWriteBarrierChunk);
                    source      = ref Unsafe.AddByteOffset(ref source, BulkMoveWithWriteBarrierChunk);
                }while (byteCount > BulkMoveWithWriteBarrierChunk);
            }
            else
            {
                // Copy backwards
                do
                {
                    byteCount -= BulkMoveWithWriteBarrierChunk;
                    __BulkMoveWithWriteBarrier(ref Unsafe.AddByteOffset(ref destination, byteCount), ref Unsafe.AddByteOffset(ref source, byteCount), BulkMoveWithWriteBarrierChunk);
                }while (byteCount > BulkMoveWithWriteBarrierChunk);
            }
            __BulkMoveWithWriteBarrier(ref destination, ref source, byteCount);
        }
Ejemplo n.º 11
0
 private static extern void __BulkMoveWithWriteBarrier(ref byte destination, ref byte source, nuint byteCount);
Ejemplo n.º 12
0
 internal static void BulkMoveWithWriteBarrier(ref byte destination, ref byte source, nuint byteCount)
 {
     if (byteCount <= BulkMoveWithWriteBarrierChunk)
     {
         __BulkMoveWithWriteBarrier(ref destination, ref source, byteCount);
     }
     else
     {
         _BulkMoveWithWriteBarrier(ref destination, ref source, byteCount);
     }
 }
Ejemplo n.º 13
0
 private static extern unsafe void __ZeroMemory(void *b, nuint byteLength);
Ejemplo n.º 14
0
 public nuint PostGetSize(nuint cbActual, BOOL fSpyed)
 => CurrentSpy?.PostGetSize(cbActual, fSpyed) ?? cbActual;
Ejemplo n.º 15
0
 public MPMediaItem GetItem(xint index)
 {
     using (var array = new NSArray(Messaging.IntPtr_objc_msgSend(Handle, Selector.GetHandle("items"))))
         return(array.GetItem <MPMediaItem> (index));
 }
Ejemplo n.º 16
0
 private static unsafe void __Memmove(byte *dest, byte *src, nuint len) =>
 RuntimeImports.memmove(dest, src, len);
Ejemplo n.º 17
0
 public MPMediaItemCollection GetCollection(xint index)
 {
     using (var array = new NSArray(Messaging.IntPtr_objc_msgSend(Handle, Selector.GetHandle("collections"))))
         return(array.GetItem <MPMediaItemCollection> (index));
 }
Ejemplo n.º 18
0
 public nuint PreAlloc(nuint cbRequest) => CurrentSpy?.PreAlloc(cbRequest) ?? cbRequest;