ret = bitstream_read_bits(istream, 16, &block_size);
if (ret != 0)
return ret;
- block_size = to_le16(block_size);
+ block_size = le16_to_cpu(block_size);
}
switch (block_type) {
ret = bitstream_read_bytes(istream, sizeof(R), R);
if (ret != 0)
return ret;
- array_to_le32(R, ARRAY_LEN(3));
- queue->R0 = R[0];
- queue->R1 = R[1];
- queue->R2 = R[2];
+ queue->R0 = le32_to_cpu(R[0]);
+ queue->R1 = le32_to_cpu(R[1]);
+ queue->R2 = le32_to_cpu(R[2]);
break;
default:
LZX_DEBUG("Found invalid block.");
return -1;
}
+#if 0
+ printf("Match: src %u, dst %u, len %u\n", match_src - window,
+ match_dest - window,
+ match_len);
+ putchar('|');
+ for (i = 0; i < match_len; i++) {
+ match_dest[i] = match_src[i];
+ putchar(match_src[i]);
+ }
+ putchar('|');
+ putchar('\n');
+#else
for (i = 0; i < match_len; i++)
match_dest[i] = match_src[i];
+#endif
return match_len;
}
i++;
continue;
}
- abs_offset = to_le32(*(int32_t*)(uncompressed_data + i + 1));
+ abs_offset = le32_to_cpu(*(int32_t*)(uncompressed_data + i + 1));
if (abs_offset >= -i && abs_offset < file_size) {
if (abs_offset >= 0) {
rel_offset = abs_offset + file_size;
}
*(int32_t*)(uncompressed_data + i + 1) =
- to_le32(rel_offset);
+ cpu_to_le32(rel_offset);
}
i += 5;
}