start to write Breakthrough
This commit is contained in:
1 parent
18d6a96b0d
commit
e27482082b
8 files changed
+158
-15
No files matched your search
@@ -0,0 +1,33 @@
|
||||
|
||||
|
||||
pub fn mov_mask(mut x: i8) -> u64{
|
||||
let mut mask: u64;
|
||||
|
||||
if x == 0 {
|
||||
return 0xffffffffffffffff;
|
||||
} else {
|
||||
if x > 0 {
|
||||
mask = 1;
|
||||
x -= 1;
|
||||
} else {
|
||||
mask = 128;
|
||||
x += 1;
|
||||
}
|
||||
}
|
||||
|
||||
while x != 0{
|
||||
if x > 0 {
|
||||
mask |= mask << 1;
|
||||
x -= 1;
|
||||
} else {
|
||||
mask |= mask >> 1;
|
||||
x += 1;
|
||||
}
|
||||
}
|
||||
|
||||
mask |= mask << 8;
|
||||
mask |= mask << 16;
|
||||
mask |= mask << 32;
|
||||
|
||||
!mask
|
||||
}
|
||||
Reference in new issue
Block a user