diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2019-06-03 10:42:25 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2019-06-03 10:42:55 -0700 |
commit | 041a5ff076e923b34e4675d753018be806d56308 (patch) | |
tree | e116e498457651bb544a663884fdeceff530b168 /util | |
parent | 5e40d3d982d014cd01db4dbe6aecc6ea6baf840a (diff) |
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>
Diffstat (limited to 'util')
-rw-r--r-- | util/qfloat16-tables/gen_qfloat16_tables.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/util/qfloat16-tables/gen_qfloat16_tables.cpp b/util/qfloat16-tables/gen_qfloat16_tables.cpp index 5aca0235e3..faedb5073c 100644 --- a/util/qfloat16-tables/gen_qfloat16_tables.cpp +++ b/util/qfloat16-tables/gen_qfloat16_tables.cpp @@ -41,6 +41,18 @@ #include <stdint.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 m = i << 13; // Zero pad mantissa bits @@ -64,7 +76,7 @@ int main() { 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("QT_BEGIN_NAMESPACE\n\n"); |