Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */
(output, input, len)
| 277 | a multiple of 4. |
| 278 | */ |
| 279 | static void Encode (output, input, len) |
| 280 | unsigned char *output; |
| 281 | UINT4 *input; |
| 282 | unsigned int len; |
| 283 | { |
| 284 | unsigned int i, j; |
| 285 | |
| 286 | for (i = 0, j = 0; j < len; i++, j += 4) { |
| 287 | output[j] = (unsigned char)(input[i] & 0xff); |
| 288 | output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); |
| 289 | output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); |
| 290 | output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | /* Decodes input (unsigned char) into output (UINT4). Assumes len is |
| 295 | a multiple of 4. |