This robopatch seems to fix the problem on arm64 with 48-bit addresses: perl -i -pe 's/longlong/ulonglong/g if /\(\s*longlong.*(<<|>>)/ && !/gen\(longlong/;' src/*.cc
The idea is to change the type whenever there seems to be a cast followed by a shift. The last condition is to avoid a couple of harmful false positives. For easier maintenance you might want to move the code that packs and unpacks addresses into one place rather than have it scattered all over the place.