Cast to uint64_t asap to avoid potential overflow