# Include <stdio. h> # include <stdlib. h> # include <malloc. h> # include <string. h> # include <ARPA/inet. h> # define row_unit 512 # define unit_length 500/* Where row_unit is the bit length used, which is an integer multiple of 64, but the product greater than uiit_length unit_length is the bit length to be converted. Unit_length is the bit length to be converted. It can also be 64, 64, etc. row_unit must be no less than unit_length */unsigned long bits_str [256]; static inline int bits_to_str_init (void) {int I, low, high; int bit_str [16] = {0x00000000, 0x00000001, 0x00000100, 0x00000101, 0x00010000, 0x00010001, 0x00010100, 0x00010101, 0x01000000, 0x01000001, 0x01000100, 0x01000101, 0x01010000, 0x01010001, 0x01010100,}; memset (bits_str, '0', sizeof (bits_str); for (I = 0; I <256; ++ I) {LOW = I & 0x0f; high = I & 0xf0; high> = 4; * (int *) & bits_str [I] + = htonl (bit_str [High]); * (int *) & bits_str [I] + 1) + = htonl (bit_str [low]);} return 0;} static inline int bitstostr (char * STR, unsigned char * bits) {int I; unsigned long * Pos = (unsigned long *) STR; int c = row_unit> 3; for (I = 0; I <C; ++ I) {* Pos = bits_str [(INT) (* bits)]; ++ Pos; ++ bits;} STR [unit_length] = 0; return 0 ;} int main (INT argc, char * argv []) {If (bits_to_str_init () <0) Return-1; unsigned char bits [64]; int I; for (I = 0; I <64; ++ I) {bits [I] = I;} Char STR [512]; bitstostr (STR, BITs ); for (I = 0; I <strlen (STR); ++ I) {printf ("% C", STR [I]); If (I + 1) & 0x7) = 0) printf ("\ n");} return 0 ;}