コード例 #1
0
        static private uint GrabInts(uint radix, String buffer, int length,
                                     ref int i, bool isUnsigned)
        {
            uint result = 0;
            uint value;
            uint maxVal;

#if DEBUG
            if (!(radix == 2 || radix == 8 || radix == 10 || radix == 16))
            {
                VTable.DebugBreak();
            }
#endif
            // Allow all non-decimal numbers to set the sign bit.
            if (radix == 10 && !isUnsigned)
            {
                maxVal = (0x7FFFFFFF / 10);
                while (i < length && IsDigit(buffer[i], radix, out value))
                {
                    // Read all of the digits and convert to a number
                    // Check for overflows - this is sufficient & correct.
                    if (result > maxVal || ((int)result) < 0)
                    {
                        throw new OverflowException("Overflow_Int32");
                    }
                    result = result * radix + value;
                    i++;
                }
                if ((int)result < 0 && result != 0x80000000)
                {
                    throw new OverflowException("Overflow_Int32");
                }
            }
            else
            {
                maxVal = UInt32.MaxValue / radix;
                while (i < length && IsDigit(buffer[i], radix, out value))
                {
                    // Read all of the digits and convert to a number
                    // Check for overflows - this is sufficient & correct.
                    if (result > maxVal)
                    {
                        throw new OverflowException("Overflow_UInt32");
                    }
                    result = result * radix + value;
                    i++;
                }
            }
            return(result);
        }
コード例 #2
0
ファイル: Delegate.cs プロジェクト: Paul1nh0/Singularity
 internal static void FixedFree(IntPtr handle)
 {
     VTable.DebugBreak();
 }
コード例 #3
0
ファイル: Delegate.cs プロジェクト: Paul1nh0/Singularity
 //////////////////////////////////////////////////////////////////////
 //
 internal static IntPtr FixedAlloc(int sizetdwBytes)
 {
     VTable.DebugBreak();
     return(IntPtr.Zero);
 }