v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
float16.h
Go to the documentation of this file.
1// Copyright 2024 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_WASM_FLOAT16_H_
6#define V8_WASM_FLOAT16_H_
7
8#include "src/base/memory.h"
9#include "third_party/fp16/src/include/fp16.h"
10
11namespace v8 {
12namespace internal {
13
14class Float16 {
15 public:
16 Float16() : bits_(0) {}
17
18 static Float16 Read(base::Address source) {
20 }
21
25
26 static Float16 FromFloat32(float f32) {
27 return Float16(fp16_ieee_from_fp32_value(f32));
28 }
29
30 float ToFloat32() const { return fp16_ieee_to_fp32_value(bits_); }
31
32 private:
33 explicit Float16(uint16_t raw_bits) : bits_(raw_bits) {}
34
35 uint16_t bits_;
36};
37
38static_assert(sizeof(Float16) == sizeof(uint16_t));
39
40} // namespace internal
41} // namespace v8
42
43#endif // V8_WASM_FLOAT16_H_
Float16(uint16_t raw_bits)
Definition float16.h:33
void Write(base::Address destination)
Definition float16.h:22
float ToFloat32() const
Definition float16.h:30
static Float16 FromFloat32(float f32)
Definition float16.h:26
static Float16 Read(base::Address source)
Definition float16.h:18
InstructionOperand destination
static V ReadUnalignedValue(Address p)
Definition memory.h:28
uintptr_t Address
Definition memory.h:13
static void WriteUnalignedValue(Address p, V value)
Definition memory.h:41