Gray code(格雷码)【代码实现】

C int gray_encode(int n) { return n ^ (n >> 1); } int gray_decode(int n) { int p = n; while (n >>= 1) p ^= n; return p; } 示例:php #include <stdio.h> /* Simple bool formatter, only g
相关文章
相关标签/搜索