commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <>
Subject [jira] [Commented] (MATH-1271) Unsigned operations
Date Thu, 10 Sep 2015 07:36:45 GMT


Luc Maisonobe commented on MATH-1271:

Including code from "Hacker's Delight" is OK as per this page:

However, what is more troublesome in the pull request is the various test methods labelled
as "A method from java.lang.Integer."
or "A method from java.lang.Long.". If these methods have been copied from a JVM, they are
subject to the JVM license.
So typically it would be GPL for openJDK. This cannot be included in Apache Commons Math.

I would suggest that rather than copying the methods and calling them from the tests we simply
put in the test the fixed values
provided by these methods (*data* output from a GPL code is not subject to the code license).

> Unsigned operations
> -------------------
>                 Key: MATH-1271
>                 URL:
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 4.0
>            Reporter: Qualtagh
>            Priority: Trivial
>              Labels: features
> 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:
> 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

View raw message