gen_qfloat16_tables: add a comment explaining what the tool is
For our future selves. Change-Id: I2b1955a995ad40f3b89afffd15a4c127686662bc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
5e40d3d982
commit
041a5ff076
@ -41,6 +41,18 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This tool generates the tables used by qfloat16 to implement a
|
||||||
|
* software-emulated version of IEEE 754 binary16. qfloat16 automatically uses
|
||||||
|
* CPU instructions to convert to and from float (IEEE 754 binary32), but if
|
||||||
|
* the CPU is not guaranteed to have those instructions available at compile
|
||||||
|
* time, then qfloat16 needs the tables to perform the conversion with
|
||||||
|
* reasonable performance.
|
||||||
|
*
|
||||||
|
* Because Qt requires float to be IEEE 754 binary32, these tables are
|
||||||
|
* platform-independent and will never change.
|
||||||
|
*/
|
||||||
|
|
||||||
uint32_t convertmantissa(int32_t i)
|
uint32_t convertmantissa(int32_t i)
|
||||||
{
|
{
|
||||||
uint32_t m = i << 13; // Zero pad mantissa bits
|
uint32_t m = i << 13; // Zero pad mantissa bits
|
||||||
@ -64,7 +76,7 @@ int main()
|
|||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
printf("/* This file was generated by gen_qfloat16_tables.cpp */\n\n");
|
printf("/* This file was generated by util/qfloat16-tables/gen_qfloat16_tables.cpp */\n\n");
|
||||||
printf("#include <QtCore/qfloat16.h>\n\n");
|
printf("#include <QtCore/qfloat16.h>\n\n");
|
||||||
|
|
||||||
printf("QT_BEGIN_NAMESPACE\n\n");
|
printf("QT_BEGIN_NAMESPACE\n\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user