summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHristo Venev <hristo@venev.name>2020-06-06 21:37:15 +0300
committerHristo Venev <hristo@venev.name>2020-06-06 21:37:15 +0300
commit1d4fc8e1a312f0c7103b2faa914a173c8581763d (patch)
tree90bf4721faecb8958415e1543a5efaedeb5cc44c
parent37f521616512d4f96eb4d40f62b784476d5a5f5d (diff)
Copy 8 bytes at a time instead of 4.
-rw-r--r--vc-log.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/vc-log.c b/vc-log.c
index e344500..7526db2 100644
--- a/vc-log.c
+++ b/vc-log.c
@@ -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;
}
}