二进制异化算法,64 块
Binary alienation algorithm, blocks of 64
我有一个异化模式想实现,问题是我数学不好,不知道怎么做,也不知道从何下手。
解释如下:
0 to 31 result: 0
32 to 95 result: 36
96 to 159 result: 72
160 to 223 result: 108
224 to 287 result: 144
288 to 351 result: 180
352 to 415 result: 216
etc...
如果输入的数字小于 32,则总是 returns 零。但是如果输入数字在32和95之间(包括32和95)returns 36,以此类推所有块。我认为这适用于 63 个块,结果增加了 36 个。
我应该如何编程才能得到这些结果??不确定是否有计算公式,因为最小输入为 0,但最大输入可能为 4294967295。
这是我目前拥有的代码:
public static uint GetXboxAlignedNumber(uint inputValue)
{
uint alignedValue = 0;
if (inputValue < 32)
{
alignedValue = 0;
}
else
{
//Here goes the code
}
return alignedValue;
}
谢谢!!
这应该有效
if (inputValue < 32)
{
return 0;
}
else
{
return (Math.Floor((inputValue - 32) / 64) + 1) * 36;
}
我有一个异化模式想实现,问题是我数学不好,不知道怎么做,也不知道从何下手。
解释如下:
0 to 31 result: 0
32 to 95 result: 36
96 to 159 result: 72
160 to 223 result: 108
224 to 287 result: 144
288 to 351 result: 180
352 to 415 result: 216
etc...
如果输入的数字小于 32,则总是 returns 零。但是如果输入数字在32和95之间(包括32和95)returns 36,以此类推所有块。我认为这适用于 63 个块,结果增加了 36 个。
我应该如何编程才能得到这些结果??不确定是否有计算公式,因为最小输入为 0,但最大输入可能为 4294967295。
这是我目前拥有的代码:
public static uint GetXboxAlignedNumber(uint inputValue)
{
uint alignedValue = 0;
if (inputValue < 32)
{
alignedValue = 0;
}
else
{
//Here goes the code
}
return alignedValue;
}
谢谢!!
这应该有效
if (inputValue < 32)
{
return 0;
}
else
{
return (Math.Floor((inputValue - 32) / 64) + 1) * 36;
}