0

In C++, we can perform uint64_t integer computation, by using the natural overflow of the uint64_t we can implement several hashing function. But when I try to implement the same hash(using C++ overflow of uint64_t) on java, I find that java does not provide C++-like unsigned integer addition and multiplication, is there any solution?

Cœur
  • 32,421
  • 21
  • 173
  • 232
chanme
  • 1
  • 1
  • While C++ and Java share some common syntax, they are otherwise completely different languages. Don't look for code that you can "translate" (because the differences can come back and bite you in the rear parts), instead look for *algorithms* that are generic and can be applied to *any* language. – Some programmer dude Oct 17 '16 at 12:08
  • 1
    You will find the bit of the `long` are exactly the same as your `unit64_t` the only difference is when you print it in decimal, Java might assume it's negative. Print it in hexadecimal, or binary and it will be the same. For examples of hashing strategies in Java https://github.com/OpenHFT/Zero-Allocation-Hashing – Peter Lawrey Oct 17 '16 at 12:12

0 Answers0