Add SWAP_LE?? and SWAP_BE?? macros, and make things use them. Converts values

to/from little endian or big endian, which is a NOP if that's what the current
platform already is.
This commit is contained in:
Rob Landley
2006-05-29 05:51:12 +00:00
parent 9755197448
commit bba7f08d27
4 changed files with 29 additions and 31 deletions

View File

@ -121,10 +121,8 @@ int unlzma(int src_fd, int dst_fd)
pos_state_mask = (1 << pb) - 1;
literal_pos_mask = (1 << lp) - 1;
#if BB_BIG_ENDIAN
header.dict_size = bswap_32(header.dict_size);
header.dst_size = bswap_64(header.dst_size);
#endif
header.dict_size = SWAP_LE32(header.dict_size);
header.dst_size = SWAP_LE64(header.dst_size);
if (header.dict_size == 0)
header.dict_size = 1;