funny bit shifts
This commit is contained in:
parent
eb579f932f
commit
b780b6b887
@ -54,23 +54,17 @@ pub const OUTPUT_MEMORY_SIZE: usize = 240;
|
||||
#[cfg(any(chuni, amdaemon))]
|
||||
#[inline(always)]
|
||||
pub fn jvs_poll(input: &[u8]) -> (u8, u8) {
|
||||
let mut opbtn = 0;
|
||||
let mut beams = 0;
|
||||
|
||||
if (input[3] & 8) != 0 {
|
||||
opbtn |= 1;
|
||||
}
|
||||
|
||||
if (input[3] & 4) != 0 {
|
||||
opbtn |= 2;
|
||||
}
|
||||
|
||||
beams |= (input[3] >> 5) & 1;
|
||||
beams |= (2 * (input[3] >> 4)) & 2;
|
||||
beams |= (4 * (input[3] >> 7)) & 4;
|
||||
beams |= (8 * (input[3] >> 6)) & 8;
|
||||
beams |= (16 * (input[4] >> 1)) & 16;
|
||||
beams |= (32 * input[4]) & 32;
|
||||
// FN1 | FN2
|
||||
let opbtn = input[3] >> 3 & 1
|
||||
| input[3] >> 1 & 2;
|
||||
|
||||
// IR1-6 in order
|
||||
let beams = input[3] >> 5 & 1
|
||||
| input[3] >> 3 & 2
|
||||
| input[3] >> 5 & 4
|
||||
| input[3] >> 3 & 8
|
||||
| input[4] << 3 & 16
|
||||
| input[4] << 5 & 32;
|
||||
|
||||
(opbtn, beams)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user