[Cryptech-Commits] [sw/libhal] 01/01: If we really must byte-swap, try doing it in hardware, to make it easier to do memcpy from software.
git at cryptech.is
git at cryptech.is
Tue Dec 1 16:53:03 UTC 2015
This is an automated email from the git hooks/post-receive script.
paul at psgd.org pushed a commit to branch hardware_htonl
in repository sw/libhal.
commit 28ac8b462ae291ff397445824b057ce09d8ab1ee
Author: Paul Selkirk <paul at psgd.org>
Date: Mon Nov 23 17:55:12 2015 -0500
If we really must byte-swap, try doing it in hardware, to make it easier to do memcpy from software.
---
hal_io_eim.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/hal_io_eim.c b/hal_io_eim.c
index fbf1d67..92f00cf 100644
--- a/hal_io_eim.c
+++ b/hal_io_eim.c
@@ -107,9 +107,7 @@ hal_error_t hal_io_write(const hal_core_t *core, hal_addr_t offset, const uint8_
offset = eim_offset(offset + hal_core_base(core));
for (; len > 0; offset += 4, buf += 4, len -= 4) {
- uint32_t val;
- val = htonl(*(uint32_t *)buf);
- eim_write_32(offset, &val);
+ eim_write_32(offset, (uint32_t *)buf);
}
return HAL_OK;
@@ -132,9 +130,7 @@ hal_error_t hal_io_read(const hal_core_t *core, hal_addr_t offset, uint8_t *buf,
offset = eim_offset(offset + hal_core_base(core));
for (; rlen > 0; offset += 4, rbuf += 4, rlen -= 4) {
- uint32_t val;
- eim_read_32(offset, &val);
- *(uint32_t *)rbuf = ntohl(val);
+ eim_read_32(offset, (uint32_t *)rbuf);
}
dump("read ", buf, len);
More information about the Commits
mailing list