From 041a5ff076e923b34e4675d753018be806d56308 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 3 Jun 2019 10:42:25 -0700 Subject: gen_qfloat16_tables: add a comment explaining what the tool is For our future selves. Change-Id: I2b1955a995ad40f3b89afffd15a4c127686662bc Reviewed-by: Allan Sandfeld Jensen --- util/qfloat16-tables/gen_qfloat16_tables.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 #include +/* + * 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 \n\n"); printf("QT_BEGIN_NAMESPACE\n\n"); -- cgit v1.2.3