I’m trying to reproduce the exact behavior of Erlang phash in another language (Ruby for example). Does anyone know the details of its implementation?
Basically, if in Erlang :
erlang:phash(X, n) -> Y
I want that
phash(X,n) = Y in Ruby.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To see how it works, check the original code: https://github.com/erlang/otp/blob/cbd1378ee1fde835e55614bac9290b281bafe49a/erts/emulator/beam/utils.c#L644
But you cannot have “exact” behaviour of phash in another language – simply because you don’t have erlang’s datatypes available there. (unless you create your own mappings of course)