| 77 | } |
| 78 | |
| 79 | void encode_85(char *buf, const unsigned char *data, int bytes) |
| 80 | { |
| 81 | say("encode 85"); |
| 82 | while (bytes) { |
| 83 | unsigned acc = 0; |
| 84 | int cnt; |
| 85 | for (cnt = 24; cnt >= 0; cnt -= 8) { |
| 86 | unsigned ch = *data++; |
| 87 | acc |= ch << cnt; |
| 88 | if (--bytes == 0) |
| 89 | break; |
| 90 | } |
| 91 | say1(" %08x", acc); |
| 92 | for (cnt = 4; cnt >= 0; cnt--) { |
| 93 | int val = acc % 85; |
| 94 | acc /= 85; |
| 95 | buf[cnt] = en85[val]; |
| 96 | } |
| 97 | buf += 5; |
| 98 | } |
| 99 | say("\n"); |
| 100 | |
| 101 | *buf = 0; |
| 102 | } |
| 103 | |
| 104 | #ifdef DEBUG_85 |
| 105 | int main(int ac, char **av) |
no test coverage detected