1 18 Jun 2015 20:40 by u/SolidBrowser
The /v/programming way:
#define BITS_IN_DATA 16 #define HEIGHT 42 extern uint16_t data[HEIGHT]; unsigned int x,y; for(y=0; y<HEIGHT; y++) for(x=0; x<BITS_IN_DATA; x++) { if(data[y] & (((uint16_t)1) << (BITS_IN_DATA - x - 1))) // :D paint_black(x,y); else paint_white(x,y); }
your welcome m8
Now with moar 1337 bro!
#define HEIGHT 42 typedef uint16_t data_type; extern data_type data[HEIGHT]; signed int x, y=0; data_type *ptr = data; data_type bit; while(ptr < data + HEIGHT) for(x=sizeof(data_type)*8-1, bit = *(ptr++); x>=0; x--, bit = bit >> 1) { bit & 1 ? paint_black(x,y) : paint_white(x,y); if(!x)y++; }
2 comments
0 u/HentaiOjisan 18 Jun 2015 23:15
The /v/programming way:
your welcome m8
0 u/HentaiOjisan 18 Jun 2015 23:35
Now with moar 1337 bro!