-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Is power of two #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is power of two #358
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good use of bitwise operations. I would recommend you try to make the function names as succinct as possible without losing the readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 😄
I've marked it as approved but I still think the log function should be moved to the parent package. Up to you @siriak 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small change 😅 everything else is perfect 😄
Wouldn't it be better if we created a new sub-package under the |
New subpackage for one function? I think this is redundant |
Could you elaborate on what you mean? If you are talking about moving just one function, then I think its not worth it - creates a lot of clutter. But if you mean to move all power of two functions in a sub package then I can see the benefits. Either way, could you elaborate? @raklaptudirm |
I was saying that instead of moving the log based algorithm to another file as you had suggested, we could create a new sub-package under
|
I am generally satisfied with both approaches, so that as most people decide, so I will do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with either approach too :)
Ah ok, I guess this is a question of opinion so majority would rule. But I would say that the binary operation functions are good inside the binary directory but the algorithm that uses log doesn't necessitate a sub package in my opinion. I guess my point would be that it depends on whether there would be other algorithms that would be added to the directory - personally I don't think there are any algorithms other than these algorithms that would go inside this subpackage - which is not a problem but it creates another layer of subdirectory for learners/explorers to browse through. We should try to keep the package structure as close to flat as possible unless there is a specific reason for creating separate package. So I guess my vote would be a no to creating a subdirectory/subpackage for it 😅. But if @siriak and @raklaptudirm disagree then go ahead with a sub package approach 😄 |
Yes, it looks like the subpackage will be redundant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move the test for the UseLog function to the parent math folder? do this dependent on whether other maintainers agree with my previous suggestion.
Done |
So what do we decide in the end, gentlemen? |
@raklaptudirm waiting on you :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was away for a bit, so could not reply earlier. All good. I am ok with the directory structure.
Checks if a number is a power of two