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
相關文章
相關標籤/搜索