Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Compiler warnings when 64-bit size_t is squashed to 32-bits #2

Open
GoogleCodeExporter opened this issue Aug 14, 2015 · 1 comment
Open

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Try compiling farmhash on a 64-bit Mac using Xcode 6.x

What is the expected output? What do you see instead?
I expect it to compile clean. Instead I get a ton of warnings:
farmhash.cc:995:26: Implicit conversion loses integer precision: 'size_t' (aka 
'unsigned long') to 'uint32_t' (aka 'unsigned int')

What version of the product are you using? On what operating system?
farmhash-1.1.0

Please provide any additional information below.

Not that anybody would try to hash 4+ gigabytes of data, but if they do, will 
it still work?

If you feel that losing precision is intentional, then a bunch of 
static_cast<uint32_t>(len) would do the trick.

Original issue reported on code.google.com by daryll...@gmail.com on 30 Jun 2015 at 5:56

@jbosboom
Copy link

If these truncations are indeed intentional and don't affect the hash quality, it would be nice to mention them in the README. There are also some -Woverflow warnings ("overflow in implicit constant conversion") in what seems to be a vector literal in farmhashte::Hash64Long that should similarly be fixed or noted as not a problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants