diff --git a/noir_stdlib/src/hash/sha256.nr b/noir_stdlib/src/hash/sha256.nr index 1bbeada3431..aa933d9dd03 100644 --- a/noir_stdlib/src/hash/sha256.nr +++ b/noir_stdlib/src/hash/sha256.nr @@ -349,6 +349,7 @@ fn update_block_item( } // Set the rightmost `zeros` number of bytes to 0. +#[inline_always] fn set_item_zeros(item: u32, zeros: u8) -> u32 { lshift8(rshift8(item, zeros), zeros) } @@ -374,6 +375,7 @@ fn get_item_byte(mut msg_item: u32, msg_byte_ptr: BLOCK_BYTE_PTR) -> u8 { // Project a byte into a position in a field based on the overall block pointer. // For example putting 1 into pointer 5 would be 100, because overall we would // have [____, 0100] with indexes [0123,4567]. +#[inline_always] fn byte_into_item(msg_byte: u8, msg_byte_ptr: BLOCK_BYTE_PTR) -> u32 { let mut msg_item = msg_byte as u32; // How many times do we have to shift to the left to get to the position we want? @@ -383,6 +385,7 @@ fn byte_into_item(msg_byte: u8, msg_byte_ptr: BLOCK_BYTE_PTR) -> u32 { } // Construct a field out of 4 bytes. +#[inline_always] fn make_item(b0: u8, b1: u8, b2: u8, b3: u8) -> u32 { let mut item = b0 as u32; item = lshift8(item, 1) + b1 as u32; @@ -394,6 +397,7 @@ fn make_item(b0: u8, b1: u8, b2: u8, b3: u8) -> u32 { // Shift by 8 bits to the left between 0 and 4 times. // Checks `is_unconstrained()` to just use a bitshift if we're running in an unconstrained context, // otherwise multiplies by 256. +#[inline_always] fn lshift8(item: u32, shifts: u8) -> u32 { if is_unconstrained() { if item == 0 {