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

10
LINES

< > BotCompany Repo | #1035025 // ubyteFromBits

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

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

1  
static int ubyteFromBits(bool b7, bool b6, bool b5, bool b4, bool b3, bool b2, bool b1, bool b0) {
2  
  ret (b7 ? 1 : 0) << 7
3  
    | (b6 ? 1 : 0) << 6
4  
    | (b5 ? 1 : 0) << 5
5  
    | (b4 ? 1 : 0) << 4
6  
    | (b3 ? 1 : 0) << 3
7  
    | (b2 ? 1 : 0) << 2
8  
    | (b1 ? 1 : 0) << 1
9  
    | (b0 ? 1 : 0);
10  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035025
Snippet name: ubyteFromBits
Eternal ID of this version: #1035025/1
Text MD5: f846fdfa1e4cc7cc143f96f4cff46143
Transpilation MD5: 424a423b10109a288f9f893492f3a5d7
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-23 02:53:25
Source code size: 297 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 131 / 178
Referenced in: [show references]