tag | ba4b2faaef069295284b047ab4b5c4ee929e91cc | |
---|---|---|
tagger | The Android Open Source Project <initial-contribution@android.com> | Wed May 05 14:56:16 2021 -0700 |
object | c577b94ed81e89bb905b7cbba8043480561afda6 |
Android mainline 11.0.0 release 12
commit | c577b94ed81e89bb905b7cbba8043480561afda6 | [log] [tgz] |
---|---|---|
author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Feb 12 20:53:13 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Feb 12 20:53:13 2020 +0000 |
tree | 7e85e45ccb22a7b95f1dd9df988edec9e6396799 | |
parent | 83162b362b3f6274fc31a6261489f1bf57677a37 [diff] | |
parent | 9c4f14e13e216b4f2aedd2177d21828f626af5a9 [diff] |
Add OWNERS am: c3ea0c58a0 am: 5432d142d5 am: 9c4f14e13e Change-Id: Id55140f63929ff55881910fd70bee562c36aa326
Header-only library for division via fixed-point multiplication by inverse
On modern CPUs and GPUs integer division is several times slower than multiplication. FXdiv implements an algorithm to replace an integer division with a multiplication and two shifts. This algorithm improves performance when an application performs repeated divisions by the same divisor.
uint32_t
, uint64_t
, and size_t
#include <fxdiv.h> /* Division of array by a constant: reference implementation */ void divide_array_c(size_t length, uint32_t array[], uint32_t divisor) { for (size_t i = 0; i < length; i++) { array[i] /= divisor; } } /* Division of array by a constant: implementation with FXdiv */ void divide_array_fxdiv(size_t length, uint32_t array[], uint32_t divisor) { const struct fxdiv_divisor_uint32_t precomputed_divisor = fxdiv_init_uint32_t(divisor); for (size_t i = 0; i < length; i++) { array[i] = fxdiv_quotient_uint32_t(array[i], precomputed_divisor); } }
Project is in alpha stage. API is unstable. Currently working features:
Platform | uint32_t | uint64_t | size_t |
---|---|---|---|
x86-64 gcc | Works | Works | Works |
x86-64 MSVC | Works | Works | Works |
x86 gcc | Works | Works | Works |
x86 MSVC | Works | Works | Works |
ARMv7 gcc | Works | Works | Works |
PPC64 gcc | Works | Works | Works |
PNaCl clang | Works | Works | Works |
Asm.js clang | Works | Works | Works |
CUDA | Untested | Untested | Untested |
OpenCL | Untested | Untested | Untested |