當前位置: 首頁>>代碼示例>>C#>>正文


C# UInt32.RotateLeft方法代碼示例

本文整理匯總了C#中System.UInt32.RotateLeft方法的典型用法代碼示例。如果您正苦於以下問題:C# UInt32.RotateLeft方法的具體用法?C# UInt32.RotateLeft怎麽用?C# UInt32.RotateLeft使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.UInt32的用法示例。


在下文中一共展示了UInt32.RotateLeft方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PostProcess

        private static void PostProcess(ref UInt32 h, UInt32[] initValues, int dataCount, byte[] remainder)
        {
            if (dataCount >= 16)
            {
                h = initValues[0].RotateLeft(1) + 
                    initValues[1].RotateLeft(7) + 
                    initValues[2].RotateLeft(12) + 
                    initValues[3].RotateLeft(18);
            }


            h += (UInt32) dataCount;

            if (remainder != null)
            {
                // In 4-byte chunks, process all process all full chunks
                for (int x = 0; x < remainder.Length / 4; ++x)
                {
                    h += BitConverter.ToUInt32(remainder, x * 4) * _primes32[2];
                    h  = h.RotateLeft(17) * _primes32[3];
                }


                // Process last 4 bytes in 1-byte chunks (only runs if data.Length % 4 != 0)
                for (int x = remainder.Length - (remainder.Length % 4); x < remainder.Length; ++x)
                {
                    h += (UInt32) remainder[x] * _primes32[4];
                    h  = h.RotateLeft(11) * _primes32[0];
                }
            }

            h ^= h >> 15;
            h *= _primes32[1];
            h ^= h >> 13;
            h *= _primes32[2];
            h ^= h >> 16;
        }
開發者ID:PragmaticIT,項目名稱:Data.HashFunction,代碼行數:37,代碼來源:xxHash.cs

示例2: ProcessGroup

        private static void ProcessGroup(ref UInt32 h1, byte[] dataGroup, int position, int length)
        {
            for (var x = position; x < position + length; x += 4)
            {
                UInt32 k1 = BitConverter.ToUInt32(dataGroup, x);

                k1 *= c1_32;
                k1 = k1.RotateLeft(15);
                k1 *= c2_32;

                h1 ^= k1;
                h1 = h1.RotateLeft(13);
                h1 = (h1 * 5) + 0xe6546b64;
            }
        }
開發者ID:PragmaticIT,項目名稱:Data.HashFunction,代碼行數:15,代碼來源:MurmurHash3.cs

示例3: Final

        private static void Final(ref UInt32 a, ref UInt32 b, ref UInt32 c)
        {
            c ^= b; c -= b.RotateLeft(14);
            a ^= c; a -= c.RotateLeft(11);
            b ^= a; b -= a.RotateLeft(25);

            c ^= b; c -= b.RotateLeft(16);
            a ^= c; a -= c.RotateLeft( 4);
            b ^= a; b -= a.RotateLeft(14);

            c ^= b; c -= b.RotateLeft(24);
        }
開發者ID:PragmaticIT,項目名稱:Data.HashFunction,代碼行數:12,代碼來源:JenkinsLookup3.cs

示例4: II

        private void II(ref UInt32 a, UInt32 b, UInt32 c,
                            UInt32 d, UInt32 x, SS s, UInt32 ac
                        )
        {
            unchecked
            {
#if !XX_inOneInstruction
                a += I(b, c, d) + x + ac;
                a = a.RotateLeft((int)s);
                a += b;
#else
				a = (a += I(b, c, d) + x + ac).RotateLeft((int)s) + b;
#endif
            }
        }
開發者ID:kirillbeldyaga,項目名稱:Labs,代碼行數:15,代碼來源:MD3.cs

示例5: Mix

        private static void Mix(ref UInt32 a, ref UInt32 b, ref UInt32 c)
        {
            a -= c; a ^= c.RotateLeft( 4); c += b;
            b -= a; b ^= a.RotateLeft( 6); a += c;
            c -= b; c ^= b.RotateLeft( 8); b += a;

            a -= c; a ^= c.RotateLeft(16); c += b;
            b -= a; b ^= a.RotateLeft(19); a += c;
            c -= b; c ^= b.RotateLeft( 4); b += a;
        }
開發者ID:PragmaticIT,項目名稱:Data.HashFunction,代碼行數:10,代碼來源:JenkinsLookup3.cs


注:本文中的System.UInt32.RotateLeft方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。