Skip to content

Commit 3255e51

Browse files
peffgitster
authored andcommitted
ewah: fix eword_t/uint64_t confusion
The ewah subsystem typedefs eword_t to be uint64_t, but some code uses a bare uint64_t. This isn't a bug now, but it's a potential maintenance problem if the definition of eword_t ever changes. Let's use the correct type. Note that we can't use COPY_ARRAY() here because the source and destination point to objects of different sizes. For that reason we'll also skip the usual "sizeof(*dst)" and use the real type, which should make it more clear that there's something tricky going on. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0f9e62e commit 3255e51

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ewah/ewah_io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ int ewah_read_mmap(struct ewah_bitmap *self, void *map, size_t len)
133133
* the endianness conversion in a separate pass to ensure
134134
* we're loading 8-byte aligned words.
135135
*/
136-
memcpy(self->buffer, ptr, self->buffer_size * sizeof(uint64_t));
137-
ptr += self->buffer_size * sizeof(uint64_t);
136+
memcpy(self->buffer, ptr, self->buffer_size * sizeof(eword_t));
137+
ptr += self->buffer_size * sizeof(eword_t);
138138

139139
for (i = 0; i < self->buffer_size; ++i)
140140
self->buffer[i] = ntohll(self->buffer[i]);

0 commit comments

Comments
 (0)