commit | 2cc0161e9b80bcd7e23e235f8c5682d8c8306f81 | [log] [tgz] |
---|---|---|
author | Xusong Wang <xusongw@google.com> | Wed Jul 20 01:30:42 2022 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Jul 20 01:30:42 2022 +0000 |
tree | b0d778382e65123821d6af73cf53d38d94ecdd68 | |
parent | e3abe6d470f96474bcdb3df867f9d4cd451b9e71 [diff] | |
parent | 6d5a6d863302e49461bde685caa638c07d3aff5e [diff] |
Change OWNERS. am: 92dd970528 am: be0c2744b5 am: e139508b6f am: 6d5a6d8633 Original change: https://android-review.googlesource.com/c/platform/external/FXdiv/+/2159997 Change-Id: Ie19862d924b4289963f3056c71595ee7b208a6d4 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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); } }
Currently working features:
Platform | uint32_t | uint64_t | size_t |
---|---|---|---|
x86-64 gcc | Works | Works | Works |
x86-64 clang | Works | Works | Works |
x86-64 MSVC | Works | Works | Works |
x86 gcc | Works | Works | Works |
x86 clang | Works | Works | Works |
x86 MSVC | Works | Works | Works |
ARMv7 gcc | Works | Works | Works |
ARMv7 clang | Works | Works | Works |
ARMv7 MSVC* | Compiles | Compiles | Compiles |
ARM64 gcc | Works | Works | Works |
ARM64 clang | Works | Works | Works |
ARM64 MSVC* | Compiles | Compiles | Compiles |
PPC64 gcc | Works | Works | Works |
WAsm clang | Works | Works | Works |
Asm.js clang | Works | Works | Works |
PNaCl clang | Works | Works | Works |
CUDA | Untested | Untested | Untested |
OpenCL | Untested | Untested | Untested |
*ARMv7 and ARM64 builds with MSVC are presumed to work, but were only verified to compile successfully