[
https://issues.apache.org/jira/browse/MATH-1271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14740462#comment-14740462
]
Qualtagh commented on MATH-1271:
--------------------------------
I have rewritten those functions from scratch. Their implementation is now
completely different from Java 8 and still obvious enough not to require
additional tests.
Patch attached.
> Unsigned operations
> -------------------
>
> Key: MATH-1271
> URL: https://issues.apache.org/jira/browse/MATH-1271
> Project: Commons Math
> Issue Type: New Feature
> Affects Versions: 4.0
> Reporter: Qualtagh
> Priority: Trivial
> Labels: features
> Attachments: MATH-1271.patch
>
>
> Add unsigned operations to ArithmeticUtils: divideUnsigned and
> remainderUnsigned. They exist in java.lang.Integer and java.lang.Long since
> Java 8. The inner implementation is based on leveraging to long (for ints)
> and to BigInteger (for longs). Comments in code suggest using tricks
> described in "Hacker's Delight" to stay with smaller type (int and long
> respectively). Those tricks were implemented in this pull request:
> https://github.com/apache/commons-math/pull/13
> I don't know if using an algorithm from "Hacker's Delight" is compatible with
> Apache license. The code is faster than standard Java 8 implementation: 2
> times for int and 8 times for long (verified with simple small tests).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)