Skip to content

Commit

Permalink
__le64/uint64_t may give the compiler a headache
Browse files Browse the repository at this point in the history
  • Loading branch information
vasi committed Jun 4, 2014
1 parent ae7fcb7 commit ebb15ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gen_swap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ${SED:-sed} -n '
/^struct squashfs_/,/^}/{
s/^struct \(squashfs_\([^[:space:]]*\)\).*/void sqfs_swapin_\2(struct \1 *s){/p;t decl
s/};/}/p;t
s/^[[:space:]]*__le\([[:digit:]]*\)[[:space:]]*\([a-z_]*\);$/sqfs_swapin\1(\&s->\2);/p
s/^[[:space:]]*__le\([[:digit:]]*\)[[:space:]]*\([a-z_]*\);$/sqfs_swapin\1_internal(\&s->\2);/p
}
d
:decl
Expand Down
4 changes: 4 additions & 0 deletions swap.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ SWAP(32)
SWAP(64)
#undef SWAP

void sqfs_swapin16_internal(__le16 *v) { sqfs_swapin16((uint16_t*)v); }
void sqfs_swapin32_internal(__le32 *v) { sqfs_swapin32((uint32_t*)v); }
void sqfs_swapin64_internal(__le64 *v) { sqfs_swapin64((uint64_t*)v); }

void sqfs_swap16(uint16_t *n) {
*n = (*n >> 8) + (*n << 8);
}
Expand Down

0 comments on commit ebb15ec

Please sign in to comment.