fl8test.c for quessing when groups change for thier
This commit is contained in:
parent
a7693c81bc
commit
23ec64bf14
38
fl8test.c
Normal file
38
fl8test.c
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// gcc fl8test.c -O2 -o fl8test
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user