[PATCH] D62088: [compiler-rt][builtins] Scaled Integer log10()

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 14:38:03 PDT 2019


leonardchan created this revision.
leonardchan added reviewers: rjmccall, bevinh, bjope.
Herald added subscribers: Sanitizers, mgorny, dberris.
Herald added projects: Sanitizers, LLVM.

This patch proposes adding a log10() function that works on scaled integers. The only 2 arguments are the integer itself and its scale. The result is also a scaled integer with the same scale as the input. If the true result cannot be precisely represented, it is rounded down towards negative infinity.

I think this would be a good function to complement fixed point types, although we use scaled integers here since the types are still hidden behind a flag. This function also isn't something specified in the Embedded C spec, though we would like to use it in Fuchsia with fixed point types.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62088

Files:
  compiler-rt/lib/builtins/CMakeLists.txt
  compiler-rt/lib/builtins/log10scaledint.c
  compiler-rt/test/builtins/Unit/log10scaledint.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62088.200100.patch
Type: text/x-patch
Size: 6006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190517/7102abb0/attachment-0001.bin>


More information about the llvm-commits mailing list