All Projects → PoslavskySV → libdivide4j

PoslavskySV / libdivide4j

Licence: other
Optimized integer division for Java

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to libdivide4j

training-mixed-precision-quantized-networks
This repository containts the pytorch scripts to train mixed-precision networks for microcontroller deployment, based on the memory contraints of the target device.
Stars: ✭ 43 (+138.89%)
Mutual labels:  integer-arithmetic
intfftk
Fully pipelined Integer Scaled / Unscaled Radix-2 Forward/Inverse Fast Fourier Transform (FFT) IP-core for newest Xilinx FPGAs (Source language - VHDL / Verilog). GNU GPL 3.0.
Stars: ✭ 43 (+138.89%)
Mutual labels:  integer-arithmetic
slimcpplib
Simple Long Integer Math for C++
Stars: ✭ 18 (+0%)
Mutual labels:  integer-arithmetic
clpz
Constraint Logic Programming over Integers
Stars: ✭ 131 (+627.78%)
Mutual labels:  integer-arithmetic
FXdiv
C99/C++ header-only library for division via fixed-point multiplication by inverse
Stars: ✭ 27 (+50%)
Mutual labels:  division
Binary-Calculator-JavaScript
📱 A handy Calculator for Binary operations, that works on all Devices 📱 💻 🖥 | ⛓ https://play.google.com/store/apps/details?id=com.binarycalculator.ayidouble.binarycalculator.app ⛓
Stars: ✭ 45 (+150%)
Mutual labels:  division

Javadocs Build Status

libdivide4j

Optimized integer division for Java

This is a Java fork of C/C++ libdivide library for fast integer division (http://libdivide.com and https://github.com/ridiculousfish/libdivide).

Fast division by constant divisor is about 2-3 times faster then ordinary Java divide operation on most of modern CPUs.

Requirements: Java 8 or higher

Examples

The typical use case is when you have to use divide operation many times with a fixed divisor.

    long[] someData = ...;
    long denominator = 45;
    FastDivision.Magic magic = FastDivision.magicSigned(denominator);

    long[] reduced = new long[someData.length];
    for (int i = 0; i < someData.length; ++i){
        // this is the same as someData[i] / denominator but 3 times faster
        reduced[i] = FastDivision.divideSignedFast(someData[i], magic);
    }

Library supports operations with unsigned integers:

    // large unsigned modulus
    long largeModulus = Long.MAX_VALUE + 1;
    // some large number
    long someNum = Long.MAX_VALUE + 99999;
    FastDivision.Magic magic = FastDivision.magicUnsigned(denominator);

    // this will give 99998 (obviously)
    long reduced = FastDivision.modUnsignedFast(someNum, magic);
    assert reduced == 99998;

Maven

Maven dependency:

    <dependency>
        <groupId>cc.redberry</groupId>
        <artifactId>libdivide4j</artifactId>
        <version>1.2</version>
    </dependency>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].