Encodes input (UINT4) into output (unsigned char). Assumes len is a multiple of 4. */
| 286 | a multiple of 4. |
| 287 | */ |
| 288 | static void Encode (unsigned char *output, UINT4 *input, unsigned int len) |
| 289 | { |
| 290 | unsigned int i, j; |
| 291 | |
| 292 | for (i = 0, j = 0; j < len; i++, j += 4) { |
| 293 | output[j] = (unsigned char)(input[i] & 0xff); |
| 294 | output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); |
| 295 | output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); |
| 296 | output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); |
| 297 | } |
| 298 | } |
| 299 | |
| 300 | /* Decodes input (unsigned char) into output (UINT4). Assumes len is |
| 301 | a multiple of 4. |