I'm experimenting with NIFs and I'm confused about what number types Erlang is working with, because I'm getting some weirdness with my precisions.
Here's an example:
erlang:band(18446744073709551614, 5) == 4
And from inside a NIF which looks something like this:
long long l, r;
enif_get_long(env, argv[0], &l);
enif_get_long(env, argv[1], &r);
return enif_make_long(env, l & r);
I get a 1 as a result.
Is this something to do with the C layer not holding the correct "size" of the number? Or is it that enif_(get|make)_long isn't the correct way to be dealing with a number of this size? Or is it simply that NIFs can't work with numbers this large?