/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/v8/src/base/float16.h
47 строк
1 KB
Michaël Zasso
deps: update V8 to 14.6.202.33
24 апр 2026, 19:01
Не верифицирован
24 апр 2026, 19:01
f1e0b83
Код
Авторство
О чём код?
// Copyright 2024 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_BASE_FLOAT16_H_ #define V8_BASE_FLOAT16_H_ #include "src/base/memory.h" #include "third_party/fp16/src/include/fp16.h" // nogncheck namespace v8 { namespace internal { class Float16 { public: Float16() : bits_(0) {} static Float16 Read(base::Address source) { return Float16(base::ReadUnalignedValue<uint16_t>(source)); } void Write(base::Address destination) { return base::WriteUnalignedValue<uint16_t>(destination, bits_); } static Float16 FromFloat32(float f32) { return Float16(fp16_ieee_from_fp32_value(f32)); } static Float16 FromBits(uint16_t bits) { return Float16(bits); } uint16_t get_bits() const { return bits_; } float ToFloat32() const { return fp16_ieee_to_fp32_value(bits_); } private: explicit Float16(uint16_t raw_bits) : bits_(raw_bits) {} uint16_t bits_; }; static_assert(sizeof(Float16) == sizeof(uint16_t)); } // namespace internal } // namespace v8 #endif // V8_BASE_FLOAT16_H_