Is there an efficient way to pass BIGINT (integers exceeding 64 bits for x86_64/amd64 architectures) between Erlang VM and the NIFs? So far I haven't found a supporting function in the enif module. Maybe converting BIGINTs to binaries will help, but there might be another good way.
Passing BIGINT between Erlang VM and the NIFs
279 Views Asked by jj1bdx At
1
There are 1 best solutions below
Related Questions in ERLANG
- erlang os:cmd() command with UTF8 binary
- Erlang syntax error unclear
- How to index a field with mongodb-erlang
- Erlang Dialyzer: only accept certain integers?
- Erlang spawning large amounts of C processes
- erlang processes and message passing architecture
- Mnesia pagination with fragmented table
- Does Erlang Have Map?
- First word of binary string erlang
- Elixir exrm release crashes on eredis start_link
- Erlang: Returning a function from a function
- How to index existing not-indexed data in riak search?
- Why do I receive a FunctionClauseError ("no function clause matching") in this Elixir program, translated from Erlang?
- How to list all the bucket types in riak?
- oauth2 authentication support in ejabberd
Related Questions in BIGINT
- Perl and Big Number
- BigInteger implementation, carry discrepancy
- Big Int implementation, how to handle leading zeros?
- Exception:Value was either too large or too small for an Int32 in asp.net?
- generate unique big integer for a tables column Laravel
- Date difference in Hours format from bigint in SQL Server
- Big JavaScript ints won't cast to String without rounding
- SystemC with c++ - how to print a sc_bigint variable?
- MySQL Automatically Calculate IBAN bigint overflow
- Return an unsigned long from vector of ints c++
- PHP int value is dependent on system
- Converting varchar to bigint in T-SQL
- How can I convert MySQL date stored as negative (signed) bigint to date format?
- C# - Class that uses ILists to store huge integers without BigInt. Can't figure out how to use CompareTo and Int.TryParse to +, -, and * two Lists
- Is there a BigInt large number class in the standard library?
Related Questions in ERLANG-NIF
- How to use NIF to interact with C code that keeps state across calls (i.e., linked lists as NIF)
- How to use binary strings in Elixir NIF
- Why does the nif function block the Erlang VM from scheduling other processes?
- Development environment for erlang on Windows
- Passing BIGINT between Erlang VM and the NIFs
- NIFs raise Segmentation Fault while loading function has try catch block to handle the exception
- NIFs Segmentation Fault without creating erl_crash.dump however code is working fine when ran normally without NIFs
- How to do Memory-mapped IO in Erlang?
- Using Erlang's NIF, How should I use malloc on ERL_NIF_TERM?
- Running Google Mock from an Erlang NIF
- difference between error_logger and error_logger_tty_h handler
- How to call `ERL_NIF_TERM` when I know that it is a funciton?
- Creating a hardware accelleration pipeline for BEAM
- Erlang NIF Test -- OS X Lion
- Problems with Erlang NIF and threads
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
This post from 2011 says there wasn't any support for big integers in the NIF API at the time. I couldn't find any such function in Erlang/OTP 21's documentation, so the statement is likely true as of today as well.
Here's how you could pass a big integer as an array of bytes:
From Erlang, instead of passing the integer directly, pass two values: the sign of the integer and the binary obtained by calling
binary:encode_unsigned/1on the integer.In the NIF function, you can get access to the bytes of the second argument using
enif_inspect_binary:bin.datanow points tobin.sizebytes, representing the bytes of the integer in Big Endian order (if you want Little Endian, passlittleas the second argument tobinary:encode_unsigned/2above).