driver_output_term() and unsigned long (32 bit) values
Scott Lystig Fritchie
fritchie@REDACTED
Tue Jul 23 03:58:49 CEST 2002
Am I correct in assuming that, if I *really* needed a driver to get
the most-significant bit of a 32 bit unsigned long sent to Erlang via
driver_output_term(), I'm out of luck?
I suppose I could do something like:
1. Modify BEAM to support unsigned integers.
2. Send the unsigned int back as a binary and then unpack it as an
":32/unsigned-integer"
3. Send the unsigned int back as a signed int, then have Erlang pack
it into a binary and then unpack it as a ":32/unsigned-integer".
4. Send back a {1, N} tuple and then have Erlang convert via "(1 bsl
31) bor N" or equivalent arithmetic.
5. Not use driver_output_term().
6. Um, I think I'd better stop now. This is getting too ugly.
Is there a better, non-ugly solution I'm missing?
-Scott
More information about the erlang-questions
mailing list