1 | // not sure if this is faster or slower than main method |
2 | static int roundUpToPowerOfTwo_alternateMethod(int v) {
|
3 | int i = Int.highestOneBit(v); |
4 | ret v > i ? i << 1 : i; |
5 | } |
Began life as a copy of #1011273
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1033645 |
| Snippet name: | roundUpToPowerOfTwo_alternateMethod |
| Eternal ID of this version: | #1033645/2 |
| Text MD5: | 394ffae8aa9e4109fdf94cefaaf4fe5b |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-12-25 21:42:08 |
| Source code size: | 176 bytes / 5 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 352 / 376 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |