Flutter Engine
The Flutter Engine
SkHalf.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "src/base/SkHalf.h"
9
11#include "src/base/SkVx.h"
12
13// NOTE: These are defined within the CPP compilation unit so that they are not inlined everywhere
14// and increase code size. Performance critical code is likely already using skvx directly, and
15// they will be inlined where performance vs. code size is worth it.
17 if (std::isnan(f)) {
18 return SK_HalfNaN;
19 } else {
20 return to_half(skvx::Vec<1,float>(f))[0];
21 }
22}
23
26}
float SkHalfToFloat(SkHalf h)
Definition: SkHalf.cpp:24
SkHalf SkFloatToHalf(float f)
Definition: SkHalf.cpp:16
uint16_t SkHalf
Definition: SkHalf.h:16
static constexpr uint16_t SK_HalfNaN
Definition: SkHalf.h:18
SIN Vec< N, float > from_half(const Vec< N, uint16_t > &x)
Definition: SkVx.h:790
SIN Vec< N, uint16_t > to_half(const Vec< N, float > &x)
Definition: SkVx.h:750
SkScalar h
Definition: SkVx.h:83