diff options
author | Hristo Venev <hristo@venev.name> | 2020-06-06 21:37:15 +0300 |
---|---|---|
committer | Hristo Venev <hristo@venev.name> | 2020-06-06 21:37:15 +0300 |
commit | 1d4fc8e1a312f0c7103b2faa914a173c8581763d (patch) | |
tree | 90bf4721faecb8958415e1543a5efaedeb5cc44c | |
parent | 37f521616512d4f96eb4d40f62b784476d5a5f5d (diff) |
Copy 8 bytes at a time instead of 4.
-rw-r--r-- | vc-log.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -37,13 +37,13 @@ static void vc_read(void *buf, size_t off, size_t size) { if(size == 0) return; - size_t skip = off % 4; - volatile uint32_t *inp = (volatile uint32_t*)((char*)vc_mem + (off - skip)); + size_t skip = off % 8; + volatile uint64_t *inp = (volatile uint64_t*)((char*)vc_mem + (off - skip)); char *out = buf; if(skip) { - uint32_t v = *inp; + uint64_t v = *inp; inp++; - size_t have = 4 - skip; + size_t have = 8 - skip; if(have >= size) { memcpy(out, (char*)&v + skip, size); return; @@ -54,15 +54,15 @@ static void vc_read(void *buf, size_t off, size_t size) { } while(1) { - uint32_t v = *inp; + uint64_t v = *inp; inp++; - if(size < 4) { + if(size < 8) { memcpy(out, &v, size); return; } - memcpy(out, &v, 4); - out += 4; - size -= 4; + memcpy(out, &v, 8); + out += 8; + size -= 8; } } |