5阶m序列

void echo32(int m) { printf("%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d\n", (m & 2147483648)>> 31, (m & 1073741824)>> 30, (m & 536870912 )>> 29, (m & 268435456 )>> 28, (m & 134217728 )>> 27, (m & 67108864 )>> 26, (m & 33554432 )>> 25, (m & 16777216 )>> 24, (m & 8388608 )>> 23, (m & 4194304 )>> 22, (m & 2097152 )>> 21, (m & 1048576 )>> 20, (m & 524288 )>> 19, (m & 262144 )>> 18, (m & 131072 )>> 17, (m & 65536 )>> 16, (m & 32768 )>> 15, (m & 16384 )>> 14, (m & 8192 )>> 13, (m & 4096 )>> 12, (m & 2048 )>> 11, (m & 1024 )>> 10 , (m & 512 )>> 9 , (m & 256 )>> 8 , (m & 128 )>> 7 , (m & 64 )>> 6 , (m & 32)>> 5, (m & 16)>> 4, (m & 8) >> 3, (m & 4) >> 2, (m & 2) >> 1, m & 1); } void m5(int iv) { int i,j,input,output; int m; int reg; //因为只有5个寄存器,所以只能有2^5-1=31组,排除全0 for(j=0;j<31;j++){ iv = iv & 31; reg = iv == 0 ? ++iv : iv; m = 0; for(i=0;i<31;i++){ output = reg & 1; input = (((reg & 4) >> 2) ^ output)<<4; reg = (reg >> 1) | input; //printf("%d",output); m=((m<<1)|output)&2147483647; //printf("%d\n",m); // } iv++; printf("%0x\n",m); //echo32(m); } printf("\n"); }

posted on 2018-08-02 18:08  阮減显  阅读(393)  评论(0编辑  收藏  举报

导航