SWFProcessing.SWFModeller.ABCDataTypeReader.ReadUI32 C# (CSharp) Method

ReadUI32() public method

Read an unsigned int, aligned to the next byte boundary
public ReadUI32 ( ) : uint
return uint
        public uint ReadUI32()
        {
            /* Pretty sure there must be a cheaper way to write this that
             * involves only unsigned types and liberal use of unchecked{}
             * blocks. */

            int v = this.ReadUI8();

            if (0 == (v & 0x80))
            {
                return (uint)v;
            }

            v = v & 0x7f | this.ReadUI8() << 7;

            if (0 == (v & 0x4000))
            {
                return (uint)v;
            }

            v = v & 0x3fff | this.ReadUI8() << 14;

            if (0 == (v & 0x200000))
            {
                return (uint)v;
            }

            v = v & 0x1fffff | this.ReadUI8() << 21;

            if (0 == (v & 0x10000000))
            {
                return (uint)v;
            }

            v = v | this.ReadUI8() << 28;

            return (uint)v;
        }