Skip to content

Commit

Permalink
Fix build for AVR
Browse files Browse the repository at this point in the history
This fixes the overflowing left shift on 8 bit platforms.

    littlefs2/lfs.c: In function ‘lfs_dir_commitcrc’:
    littlefs2/lfs.c:1654:51: error: left shift count >= width of type [-Werror=shift-count-overflow]
             commit->ptag = ntag ^ ((0x80 & ~eperturb) << 24);
  • Loading branch information
benpicco committed May 5, 2023
1 parent ec3ec86 commit 6fda813
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ static int lfs_dir_commitcrc(lfs_t *lfs, struct lfs_commit *commit) {

commit->off = noff;
// perturb valid bit?
commit->ptag = ntag ^ ((0x80 & ~eperturb) << 24);
commit->ptag = ntag ^ ((0x80UL & ~eperturb) << 24);
// reset crc for next commit
commit->crc = 0xffffffff;

Expand Down

0 comments on commit 6fda813

Please sign in to comment.