Skip to content

Commit

Permalink
crc32: Replaced the __builtin_swap32() shenanigan with a proper big…
Browse files Browse the repository at this point in the history
… endian buffer reader function
  • Loading branch information
dragonmux authored and esden committed Jul 22, 2023
1 parent e9e9855 commit 6e397a5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ bool generic_crc32(target_s *const target, uint32_t *const result, const uint32_
}
#else
#include <libopencm3/stm32/crc.h>
#include "buffer_utils.h"

bool generic_crc32(target_s *const target, uint32_t *const result, const uint32_t base, const size_t len)
{
Expand All @@ -160,7 +161,7 @@ bool generic_crc32(target_s *const target, uint32_t *const result, const uint32_
}

for (size_t i = 0; i < read_len; i += 4U)
CRC_DR = __builtin_bswap32(*(uint32_t *)(bytes + i));
CRC_DR = read_be4(bytes, i);
}

uint32_t crc = CRC_DR;
Expand Down

0 comments on commit 6e397a5

Please sign in to comment.