aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2025-04-11 10:16:04 +0200
committerDaniel Schadt <kingdread@gmx.de>2025-04-11 10:16:04 +0200
commit34ed0189281fcca1921d4e3d762e6d9183d5230f (patch)
tree649e9410660556e78fa687e50da9b0f0ec7281a6
parent1d5e3db348227d5658e11782b123139c1d5d5e25 (diff)
downloadzears-34ed0189281fcca1921d4e3d762e6d9183d5230f.tar.gz
zears-34ed0189281fcca1921d4e3d762e6d9183d5230f.tar.bz2
zears-34ed0189281fcca1921d4e3d762e6d9183d5230f.zip
roll Block::mul back up
I've unrolled this earlier to speed up the computation for the commonly used factors, but now we're precomputing the values anyway so there's no reason to keep the code ugly.
-rw-r--r--src/block.rs51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/block.rs b/src/block.rs
index 8bf8647..c294aab 100644
--- a/src/block.rs
+++ b/src/block.rs
@@ -156,57 +156,6 @@ impl Mul<u32> for Block {
}
result
}
- 3 => {
- let mut result = self << 1;
- if self[0] & 0x80 != 0 {
- result[15] ^= 0x87;
- }
- result ^ self
- }
- 4 => {
- let mut result = self << 2;
- if self[0] & 0x80 != 0 {
- result[15] ^= 0x0E;
- result[14] ^= 0x01;
- }
- if self[0] & 0x40 != 0 {
- result[15] ^= 0x87;
- }
- result
- }
- 5 => {
- let mut result = self << 2;
- if self[0] & 0x80 != 0 {
- result[15] ^= 0x0E;
- result[14] ^= 0x01;
- }
- if self[0] & 0x40 != 0 {
- result[15] ^= 0x87;
- }
- result ^ self
- }
- 6 => {
- let mut result = self << 1;
- if self[0] & 0x80 != 0 {
- result[15] ^= 0x87;
- }
- result = result ^ self;
- let mask = if result[0] & 0x80 != 0 { 0x87 } else { 0 };
- result = result << 1;
- result[15] ^= mask;
- result
- }
- 7 => {
- let mut result = self << 1;
- if self[0] & 0x80 != 0 {
- result[15] ^= 0x87;
- }
- result = result ^ self;
- let mask = if result[0] & 0x80 != 0 { 0x87 } else { 0 };
- result = result << 1;
- result[15] ^= mask;
- result ^ self
- }
_ if rhs % 2 == 0 => self * 2 * (rhs / 2),
_ => self * (rhs - 1) ^ self,
}