blob: d344e1672a3f02421b9adedce10f0b7bad057812 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
using System;
namespace Org.BouncyCastle.Math.Raw
{
internal abstract class Bits
{
internal static uint BitPermuteStep(uint x, uint m, int s)
{
uint t = (x ^ (x >> s)) & m;
return (t ^ (t << s)) ^ x;
}
internal static ulong BitPermuteStep(ulong x, ulong m, int s)
{
ulong t = (x ^ (x >> s)) & m;
return (t ^ (t << s)) ^ x;
}
internal static uint BitPermuteStepSimple(uint x, uint m, int s)
{
return ((x & m) << s) | ((x >> s) & m);
}
internal static ulong BitPermuteStepSimple(ulong x, ulong m, int s)
{
return ((x & m) << s) | ((x >> s) & m);
}
}
}
|