Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

3
LINES

< > BotCompany Repo | #1028514 // numberOfBitsNeededToRepresentNOptions - basically a dual logarithm

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (75L/1K).

static int numberOfBitsNeededToRepresentNOptions(int i) {
  ret 32-Int.numberOfLeadingZeros(max(0, i-1));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028514
Snippet name: numberOfBitsNeededToRepresentNOptions - basically a dual logarithm
Eternal ID of this version: #1028514/1
Text MD5: 4226e9d2c9e9494bb13d0e9e5a142fcf
Transpilation MD5: 3b73e5cb51e7f48a5c67e04015ccaf38
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-06-23 17:48:38
Source code size: 109 bytes / 3 lines
Pitched / IR pitched: No / No
Views / Downloads: 236 / 330
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030522 - dualLog - dual logarithm (base 2), rounded up [is it called "binary logarithm"?]
#1035686 - numberOfBits