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.
Many thanks!
I'm assuming you're asking about the left bit (aka binary) shift operators <<
It can be confusing at first, because the same operator is overloaded by e.g. stringstream to append things to the stream.
But originally the << and >> operators shift bits in an integer. Combined with & (and) operation, it is used here to extract 8 bit parts of the original 32 bit number.
Take a look here https://www.educative.io/answers/what-are-bit-shift-operations . And here https://www.tutorialspoint.com/cplusplus/cpp_operators.htm .
Given an
uint32_t
variableip
, you can extract four 8 bit chunks like that:To reverse it:
Hope that helps :)
Please, help me understand how this code works. If it possible give me a tip about how to google a theory about it.
Approved. Thanks!
Approved!
Javascript translation added. Please review and approve.
I'm sorry, Ciprian Amza, I didn't see your changes while editing it myself. Maybe we should keep your more detailed explanation.
Changed description in following sentences:
and
After the apparently not so smart decision of approving a kata whose author has been inactive for some months, I tried to clarify the description regarding the open issues.
In this case I changed the first rule of error reporting to:
Thank you very much for your help. I have updated the reference solution with proper formatting. You should no longer get that warning. I tested with your solution and my solution. Neither produced a warning, and both passed all tests. Thanks for testing my kata, and providing valuable feedback.
Interesting kata. However, your reference solution gives following warning in stderr:
Maybe you could change the way of parsing
sentenceDate
.How about just changing the description to include those in real life maybe even more efficient solutions, too? @balygaby
I changed the tests to report
Yeah, I realized it afterwards too. However, learned some new things tonight, not only about JS's intricacies. Thank you!
I tried to improve balygaby's reference solution and test cases in this regard. Please check.
Loading more items...