summaryrefslogtreecommitdiffhomepage
path: root/src/dump.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-01-20 23:12:43 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-01-20 23:12:43 +0900
commit47a68e89ffcfcacb4a0c6c64c3b2ab69ee4da35f (patch)
treeef21aeddd840459cef963c2f360c27673117a1e4 /src/dump.c
parente91dfd07be6e07179814cfc17be182fd114c3d28 (diff)
downloadmruby-47a68e89ffcfcacb4a0c6c64c3b2ab69ee4da35f.tar.gz
mruby-47a68e89ffcfcacb4a0c6c64c3b2ab69ee4da35f.zip
Remove CRC16 from dumped mruby binary.
`calc_crc_16_ccitt()` consumes a lot of clock cycles in programs like `mrbtest` which loads a lot of dumped binary. Error detection for flaky channels should be done in the higher level. Note: `mruby/c` should be updated to support this change.
Diffstat (limited to 'src/dump.c')
-rw-r--r--src/dump.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/src/dump.c b/src/dump.c
index 79908b47f..10b6d9dec 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -747,8 +747,6 @@ static int
write_rite_binary_header(mrb_state *mrb, size_t binary_size, uint8_t *bin, uint8_t flags)
{
struct rite_binary_header *header = (struct rite_binary_header *)bin;
- uint16_t crc;
- uint32_t offset;
memcpy(header->binary_ident, RITE_BINARY_IDENT, sizeof(header->binary_ident));
memcpy(header->major_version, RITE_BINARY_MAJOR_VER, sizeof(header->major_version));
@@ -758,10 +756,6 @@ write_rite_binary_header(mrb_state *mrb, size_t binary_size, uint8_t *bin, uint8
mrb_assert(binary_size <= UINT32_MAX);
uint32_to_bin((uint32_t)binary_size, header->binary_size);
- offset = (uint32_t)((&(header->binary_crc[0]) - bin) + sizeof(uint16_t));
- crc = calc_crc_16_ccitt(bin + offset, binary_size - offset, 0);
- uint16_to_bin(crc, header->binary_crc);
-
return MRB_DUMP_OK;
}