...
 
Commits (2)
......@@ -259,6 +259,9 @@ public struct PermutationInt32 : IPermutation<P>
}
return new P(_mix ^ value);
}
internal static P FromInt32Internal(int value) {
return new P(value ^ _mix);
}
public static P FromInt32(int value) {
if((value & -0x77777778) != 0)
_throwInt32(string.Format(
......
......@@ -16,7 +16,7 @@ namespace DotNetTransformer.Math.Permutation {
public struct PermutationInt64 : IPermutation<P>
{
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
internal readonly long _value;
private readonly long _value;
internal PermutationInt64(long value) { _value = value; }
public PermutationInt64(params byte[] array) : this((IEnumerable<byte>)array) { }
public PermutationInt64(IEnumerable<byte> collection) {
......@@ -267,6 +267,9 @@ public struct PermutationInt64 : IPermutation<P>
}
return new P(_mix ^ value);
}
internal static P FromInt64Internal(long value) {
return new P(value ^ _mix);
}
public static P FromInt64(long value) {
byte startIndex = 0;
for(byte digit = 0; digit < _count; ++digit) {
......
......@@ -178,7 +178,7 @@ private sealed class InternalGroup : FiniteGroup<T>
const int b = 0x11111111;
for(byte i = 0, l = 4; i < _dimCount; ++i, l <<= 1)
v ^= ((1 << l) - 1 & (b << p[i]) ^ v) << l;
return new PermutationInt32(v ^ 0x76543210);
return PermutationInt32.FromInt32Internal(v);
}
/// <exception cref="ArgumentException">
......
......@@ -155,7 +155,7 @@ private sealed class InternalGroup : FiniteGroup<T>
const long b = 0x1111111111111111L;
for(byte i = 0, l = 4; i < _dimCount; ++i, l <<= 1)
v ^= ((1L << l) - 1L & (b << p[i]) ^ v) << l;
return new PermutationInt64(v ^ -0x123456789ABCDF0L);
return PermutationInt64.FromInt64Internal(v);
}
/// <exception cref="ArgumentException">
......