Re:VS Code can do that?
by andrepd on Saturday April 21, 2018 @02:21PM
(#16892558)
Languages/compilers that don't do loop-unrolling automatically. If they do, then yes, it's probably best to let the compiler do it.
[ Parent
| on HN ]
Like which?
Re:VS Code can do that?
by staticassertion on Saturday April 21, 2018 @04:19PM
(#16893220)
All of the languages I can think of rely on the compiler backend for loop unrolling, which means it isn't a guarantee. You might want this if you need to guarantee the unroll.
But I wasn't doing this for a loop unroll.
I had a fixed size array that I wanted to serialize/ deserialize to/ from capnproto - there are no fixed size arrays in capnproto, so I wrote a message that just had b1, b2, b3... b16, and then some code to pull it out into a statically sized array. It allowed me to pull a bunch of bytes into a much larger statically allocated array without any allocation or bounds checking.