candu / node-int64-native

A simple uint64_t wrapper for node.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support for basic arithmetic operations

jkryl opened this issue · comments

it would be nice if int64-native supported basic arithmetic operations (add and sub), so that people don't have to implement their own versions of such operations in JS (especially if they can be done so easily in C/C++). Arithmetic brings a problem of distinguishing between signed and unsigned representation of numbers. I have created a patch and made my life easier by treating all int64 numbers as unsigned and let user to determine how he wants to treat the result (i.e. by calling either toUnsignedDecimal() or toSignedDecimal() method), because the internal representation of the number whether it's signed or unsigned remains the same.

If people agree that this would be nice thing to have, I can submit a pull request.

Sounds reasonable - submit a pull request and I'll take a look at it :)