30 lines · c
1/* SPDX-License-Identifier: MIT */2 3/* Copyright 2024 Advanced Micro Devices, Inc. */4 5#ifndef SPL_CUSTOM_FLOAT_H_6#define SPL_CUSTOM_FLOAT_H_7 8#include "spl_os_types.h"9#include "spl_fixpt31_32.h"10 11struct spl_custom_float_format {12 uint32_t mantissa_bits;13 uint32_t exponenta_bits;14 bool sign;15};16 17struct spl_custom_float_value {18 uint32_t mantissa;19 uint32_t exponenta;20 uint32_t value;21 bool negative;22};23 24bool spl_convert_to_custom_float_format(25 struct spl_fixed31_32 value,26 const struct spl_custom_float_format *format,27 uint32_t *result);28 29#endif //SPL_CUSTOM_FLOAT_H_30