source: Daodan/MinGW/msys/1.0/share/awk/bits2str.awk@ 1153

Last change on this file since 1153 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 327 bytes
Line 
1# bits2str --- turn a byte into readable 1's and 0's
2
3function bits2str(bits, data, mask)
4{
5 if (bits == 0)
6 return "0"
7
8 mask = 1
9 for (; bits != 0; bits = rshift(bits, 1))
10 data = (and(bits, mask) ? "1" : "0") data
11
12 while ((length(data) % 8) != 0)
13 data = "0" data
14
15 return data
16}
Note: See TracBrowser for help on using the repository browser.