Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Updated my six year old solution. I thought about doing an __asm__ instruction, but considered the many different architectures the code could run on. Found this compiler intrinsic, supported in GCC and Clang. Other compilers may have their own builtins, but this code only runs on Clang so I didn't bother.
This builtin essentially places the assembly instruction for you, based on the architecture, to have the hardware count the bits in a loop, as opposed to us bitshifting around.
You have a hidden allocation here.
for indx, c := range coord
is actually making a copy ofcoord
and iterating it. That's only because you have, c
there. If you remove the second for loop value, it will not copy and you will need to indexcoord
yourself atindx
.Nice. Didn't know that was possible. But keep in mind I believe this causes the regex to be compiled on each function call. It would be better to have the regex compiled in a var outside of the function.
This comment is hidden because it contains spoiler information about the solution
Thank you a lot!
ASM learner here: how are you supposed to know which register an argument is passed from C?
Oops, the buffer length on snprintf should only be 25.
Best part is it's ironically over complicated code for just two commands.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution