Faster remainder by direct computation: Applications to compilers and software libraries

  title={Faster remainder by direct computation: Applications to compilers and software libraries},
  author={Daniel Lemire and Owen Kaser and Nathan Kurz},
  journal={Software: Practice and Experience},
  pages={953 - 970}
On common processors, integer multiplication is many times faster than integer division. Dividing a numerator n by a divisor d is mathematically equivalent to multiplication by the inverse of the divisor (n/d=n∗1/d). If the divisor is known in advance, or if repeated integer divisions will be performed with the same divisor, it can be beneficial to substitute a less costly multiplication for an expensive division. Currently, the remainder of the division by a constant is computed from the… Expand
A 32-bit Integer Division Algorithm Based on Priority Encoder
An algorithm for 32-bit integer division of positive and negative dividends and divisors represented in sign and magnitude is proposed and its functionality was verified by ModelSim simulations. Expand
Padding in the mathematics of arrays
Multi-dimensional array manipulation constitutes a core component of numerous numerical methods, e.g. finite difference solvers of Partial Differential Equations (PDEs). The efficiency of suchExpand
Euclidean Affine Functions and Applications to Calendar Algorithms
The main application presented in this article relates to Gregorian calendar algorithms and it is shown how they can be implemented substantially more efficiently than is currently the case in widely used C, C++, C# and Java open source libraries. Expand
A Constant Time Full Hardware Implementation of Streamlined NTRU Prime
This work implements the entire KEM algorithm, including all steps for key generation, encapsulation and decapsulation, and all enand decoding, in a constant time hardware implementation of the NIST round 2 post-quantum cryptographic algorithm Streamlined NTRU Prime. Expand
MUSE: Multi-Use Error Correcting Codes
In this work we present a new set of error correcting codes – Multi-Use Error Correcting Codes (MUSE ECC) – that have the ability to match reliability guarantees of all commodity, conventionalExpand
Integer division by constants: optimal bounds
This work presents optimally tight bounds for quotient and remainder computations for convenient integers c and m chosen so that they approximate the reciprocal: c/m≈1/d. Expand
Number parsing at a gigabyte per second
  • D. Lemire
  • Computer Science
  • Softw. Pract. Exp.
  • 2021
By combining the significand and precomputed tables, the solution to the problem of parsing decimal numbers to the nearest binary floating‐point value can be several times faster than conventional functions present in standard C libraries on modern 64‐bit systems. Expand
c-Trie++: A Dynamic Trie Tailored for Fast Prefix Searches
This work proposes a keyword dictionary that represents K in n lg σ + Θ (k lg n) bits of space, supporting all operations in Θ(m / α + lg α) expected time on an input string of length m in the word RAM model. Expand


Efficient Algorithms for Integer Division by Constants Using Multiplication
This analysis leads to the discovery of a limit to the straightforward application of this method in the form of a critical dividend, which fortunately associates with a minority of the possible divisors and defines only a small upper part of the available dividend space. Expand
Improved Division by Invariant Integers
An algorithm is described that produces a quotient and remainder using one umul and one umullo, which is an improvement over earlier methods, since the new method uses cheaper multiplication operations. Expand
Hardware Division by Small Integer Constants
The article studies whether the division by the product of two constants is better implemented as two successive dividers or as one atomic divider, and considers the case when only a quotient or only a remainder is needed. Expand
Division by invariant integers using multiplication
This paper presents code sequences for division by arbitrary nonzero integer constants and run-time invariants using integer multiplication using a two's complement architecture, and treats unsigned division, signed division, and division where the result is known a priori. Expand
Efficient and formally proven reduction of large integers by small moduli
This work presents a modular reduction algorithm implementing division by a modulus through multiplication by a reciprocal of that modulus, a well-known method for moduli larger than 2w-1, and shows that application of this method to smaller moduli makes it possible to express certain modular sums and differences without having to compensate for word overflows. Expand
Constant-division algorithms
There exist many types of special-purpose systems that require rapid and repeated division by a set of known constant divisors. Numerous solutions have been proposed in response to the deficienciesExpand
A Combinatoric Division Algorithm for Fixed-Integer Divisors
A procedure is presented for performing a combinatoric fixed-integer division that satisfies the division algorithm in regard to both quotient and remainder. In this procedure, division is performedExpand
Special Cases of Division
  • R. W. Doran
  • Computer Science
  • J. Univers. Comput. Sci.
  • 1995
This surveys algorithms and circuits for integer division in special cases. These include division by constants, small divisors, exact divisors, and cases where the divisor and the number base have aExpand
IBM POWER8 processor core microarchitecture
The core microarchitecture innovations made in the POWER8 processor, designed to significantly improve both single-thread performance and single-core throughput over its predecessor, the POWER7® processor, are described. Expand
Hacker's Delight
The term "hacker" in the title is meant in the originalsense of an aficionado of computers—someone who enjoys making computers do new things, or do old things in a new and clever way. Expand