aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/skcms/src/PortableMath.c
diff options
context:
space:
mode:
authorGravatar skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com>2018-07-02 19:08:45 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-02 19:38:22 +0000
commit5155d38fdcd4d4e94181bf01ef4831e442a4380b (patch)
tree710a7e7c650aed6b81acf917c7272e1c07cffe1c /third_party/skcms/src/PortableMath.c
parent5dfd0694dc0b320e13eb7e253b77419b32ceab49 (diff)
Roll skia/third_party/skcms 14ea609fa6ca..99b01c076f47 (1 commits)
https://skia.googlesource.com/skcms.git/+log/14ea609fa6ca..99b01c076f47 2018-07-02 mtklein@chromium.org move skcms impl into skcms.c The AutoRoll server is located here: https://skcms-skia-roll.skia.org Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel TBR=ethannicholas@google.com Change-Id: I950f7b604eef056641fec3e6691d8c8a928d2d37 Reviewed-on: https://skia-review.googlesource.com/138950 Commit-Queue: skcms-skia-autoroll <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com> Reviewed-by: skcms-skia-autoroll <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com>
Diffstat (limited to 'third_party/skcms/src/PortableMath.c')
-rw-r--r--third_party/skcms/src/PortableMath.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/third_party/skcms/src/PortableMath.c b/third_party/skcms/src/PortableMath.c
deleted file mode 100644
index 52e8b7d1c8..0000000000
--- a/third_party/skcms/src/PortableMath.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "../skcms.h"
-#include "../skcms_internal.h"
-#include <limits.h>
-#include <string.h>
-
-#if defined(__clang__) || defined(__GNUC__)
- #define small_memcpy __builtin_memcpy
-#else
- #define small_memcpy memcpy
-#endif
-
-float log2f_(float x) {
- // The first approximation of log2(x) is its exponent 'e', minus 127.
- int32_t bits;
- small_memcpy(&bits, &x, sizeof(bits));
-
- float e = (float)bits * (1.0f / (1<<23));
-
- // If we use the mantissa too we can refine the error signficantly.
- int32_t m_bits = (bits & 0x007fffff) | 0x3f000000;
- float m;
- small_memcpy(&m, &m_bits, sizeof(m));
-
- return (e - 124.225514990f
- - 1.498030302f*m
- - 1.725879990f/(0.3520887068f + m));
-}
-
-float exp2f_(float x) {
- float fract = x - floorf_(x);
-
- float fbits = (1.0f * (1<<23)) * (x + 121.274057500f
- - 1.490129070f*fract
- + 27.728023300f/(4.84252568f - fract));
- if (fbits > INT_MAX) {
- return INFINITY_;
- } else if (fbits < INT_MIN) {
- return -INFINITY_;
- }
- int32_t bits = (int32_t)fbits;
- small_memcpy(&x, &bits, sizeof(x));
- return x;
-}
-
-float powf_(float x, float y) {
- return (x == 0) || (x == 1) ? x
- : exp2f_(log2f_(x) * y);
-}