Skip to content

Commit b4d0285

Browse files
committed
removing sizeofs
1 parent 17b1635 commit b4d0285

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

blake2/src/blake2b.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,20 @@ pub(crate) type Count = u128;
5151
type Output = GenericArray<u8, U64>;
5252

5353
/// The max hash length.
54-
pub const OUTBYTES: usize = 8 * size_of::<Word>();
54+
pub const OUTBYTES: usize = 8 * (Word::BITS as usize / 8);
5555

5656
/// The max key length.
57-
pub const KEYBYTES: usize = 8 * size_of::<Word>();
57+
pub const KEYBYTES: usize = 8 * (Word::BITS as usize / 8);
5858

5959
/// The max salt length.
60-
pub const SALTBYTES: usize = 2 * size_of::<Word>();
60+
pub const SALTBYTES: usize = 2 * (Word::BITS as usize / 8);
6161

6262
/// The max personalization length.
63-
pub const PERSONALBYTES: usize = 2 * size_of::<Word>();
63+
pub const PERSONALBYTES: usize = 2 * (Word::BITS as usize / 8);
6464

6565
/// The number input bytes passed to each call to the compression function. Small benchmarks need
6666
/// to use an even multiple of `BLOCKBYTES`, or else their apparent throughput will be low.
67-
pub const BLOCKBYTES: usize = 16 * size_of::<Word>();
67+
pub const BLOCKBYTES: usize = 16 * (Word::BITS as usize / 8);
6868

6969
const IV: [Word; 8] = [
7070
0x6A09E667F3BCC908,

blake2/src/blake2b/backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ pub(crate) fn count_low(count: Count) -> Word {
225225
}
226226

227227
pub(crate) fn count_high(count: Count) -> Word {
228-
(count >> (8 * size_of::<Word>())) as Word
228+
(count >> (8 * (Word::BITS as usize / 8))) as Word
229229
}
230230

231231
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]

blake2/src/blake2s.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,20 @@ pub(crate) type Count = u64;
5050
type Output = GenericArray<u8, U32>;
5151

5252
/// The max hash length.
53-
pub const OUTBYTES: usize = 8 * size_of::<Word>();
53+
pub const OUTBYTES: usize = 8 * (Word::BITS as usize / 8);
5454

5555
/// The max key length.
56-
pub const KEYBYTES: usize = 8 * size_of::<Word>();
56+
pub const KEYBYTES: usize = 8 * (Word::BITS as usize / 8);
5757

5858
/// The max salt length.
59-
pub const SALTBYTES: usize = 2 * size_of::<Word>();
59+
pub const SALTBYTES: usize = 2 * (Word::BITS as usize / 8);
6060

6161
/// The max personalization length.
62-
pub const PERSONALBYTES: usize = 2 * size_of::<Word>();
62+
pub const PERSONALBYTES: usize = 2 * (Word::BITS as usize / 8);
6363

6464
/// The number input bytes passed to each call to the compression function. Small benchmarks need
6565
/// to use an even multiple of `BLOCKBYTES`, or else their apparent throughput will be low.
66-
pub const BLOCKBYTES: usize = 16 * size_of::<Word>();
66+
pub const BLOCKBYTES: usize = 16 * (Word::BITS as usize / 8);
6767

6868
const IV: [Word; 8] = [
6969
0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19,

blake2/src/blake2s/backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ pub(crate) fn count_low(count: Count) -> Word {
223223
}
224224

225225
pub(crate) fn count_high(count: Count) -> Word {
226-
(count >> (8 * size_of::<Word>())) as Word
226+
(count >> (8 * (Word::BITS as usize / 8))) as Word
227227
}
228228

229229
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]

0 commit comments

Comments
 (0)