以下是引用yang35343在2014-3-25 20:49:13的发言:
你要什么重谢,你说啊
我什么都不要,我只是想看看你所谓的“重谢”是什么。但现在听你这么说,我猜到你当时也就是随口一说,并没有真想给出什么重谢。
0013054901 对应 E6C0
0030611401 对应 8F1A
0905096501 对应 DB68
程序代码:
unsigned short foo( unsigned long long n )
{
unsigned long long r = n<<8;
for( unsigned i=0; i<64; ++i )
r = (r<<1) ^ (r&0x8000000000000000ull ? 0x1021000000000000ull : 0);
return (unsigned short)(r>>48);
}
#include <stdio.h>
#include <assert.h>
int main()
{
assert( foo(0x0000000001) == 0x3331 );
assert( foo(0x0000000002) == 0x6662 );
assert( foo(0x0000000003) == 0x5553 );
assert( foo(0x0000000004) == 0xCCC4 );
assert( foo(0x0000000005) == 0xFFF5 );
assert( foo(0x0000000006) == 0xAAA6 );
assert( foo(0x0000000101) == 0x0401 );
assert( foo(0x0000000201) == 0x5D51 );
assert( foo(0x0000000301) == 0x6A61 );
assert( foo(0x0023537501) == 0x0848 );
assert( foo(0x0023537510) == 0x380A );
assert( foo(0x0010031103) == 0xBE86 );
printf( "%04hX\n", foo(0x0013054901) ); // 输出 E6C0
printf( "%04hX\n", foo(0x0030611401) ); // 输出 8F1A
printf( "%04hX\n", foo(0x0905096501) ); // 输出 DB68
return 0;
}