From 23ec64bf146db3e66542b739bf9259f13fc110f8 Mon Sep 17 00:00:00 2001 From: Richard Thier Date: Mon, 10 Apr 2023 20:04:46 +0200 Subject: [PATCH] fl8test.c for quessing when groups change for thier --- fl8test.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 fl8test.c diff --git a/fl8test.c b/fl8test.c new file mode 100644 index 0000000..6e95ac5 --- /dev/null +++ b/fl8test.c @@ -0,0 +1,38 @@ +// gcc fl8test.c -O2 -o fl8test +#include +#include +#include + +union fu { + float f; + uint32_t u; +}; + +uint32_t until = 2048; +uint32_t shift = 24; +uint32_t groupcnt = 0; +int main (int argc, char **argv) { + if(argc > 1) { + const char* arg = argv[1]; + until = atoi(arg); + } + if(argc > 2) { + const char* arg = argv[2]; + shift = atoi(arg); + } + + uint32_t prev = (uint32_t) -1; + for(uint32_t i = 0; i < until; ++i) { + union fu fui; + fui.f = (float) i; + fui.u = (fui.u >> shift); + + if(fui.u != prev) { + printf("%d -> %d\n", i, fui.u); + ++groupcnt; + } + prev = fui.u; + } + + printf("Until %d, there are %d groups!\n", until, groupcnt); +}