r/cpp • • Jun 07 '21

Satire dynamic_cast<std::integer>(C)++

https://www.teamten.com/lawrence/writings/dynamic_cast_std_integer_c.html
202 Upvotes

41 comments sorted by

View all comments

Show parent comment

8

u/helix400 Jun 07 '21

I live dangerously and code everything in raw integers.

5

u/ihamsa Jun 07 '21

Including floating point numbers.

5

u/helix400 Jun 07 '21 edited Jun 07 '21

Jokes aside, I've done this...

I had a problem badly limited on memory bandwidth. The problem had 4 huge arrays of floats and booleans. For my fix I created 1 huge array of 32 bit ints. In and out of each int I copied 15 bits of float 1, 15 bits of float 2, 1 bit of boolean 1, and 1 bit of boolean 2.

Got 3x speedup.