Skip to content

Commit

Permalink
Adjust to left shift operation changes in Noir (#12)
Browse files Browse the repository at this point in the history
* adjust to left shift operation changes in Noir version `0.19.3` - change `std::wrapping_shift_left` to `<<`
  • Loading branch information
akonior authored Jan 3, 2024
1 parent ee90be4 commit 57f7cd7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Install Nargo
uses: noir-lang/[email protected]
with:
toolchain: 0.19.2
toolchain: 0.19.4

- name: Run nargo test
run: |
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.1.2](https://github.com/zkworks-xyz/noir-base64/commits/v0.1.2...v0.1.0) (2024-01-03)


### Changes

* adjust to left shift operation changes in Noir version `0.19.3` - change `std::wrapping_shift_left` to `<<` ([#11](https://github.com/zkworks-xyz/noir-base64/issues/11))

## [0.1.1](https://github.com/zkworks-xyz/noir-base64/commits/v0.1.1) (2023-11-28)


Expand Down
2 changes: 1 addition & 1 deletion Nargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
name = "base64"
type = "lib"
authors = [""]
compiler_version = ">=0.19.2"
compiler_version = ">=0.19.4"

[dependencies]
6 changes: 3 additions & 3 deletions src/lib.nr
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ fn convert_chunk<N>(input: [u8; N], url_safe: bool) -> [u8; 4] {
let mut result = [64; 4];

let input0_first6 = input[0] >> 2;
let input0_last2 = std::wrapping_shift_left(input[0], 6) >> 2;
let input0_last2 = (input[0] << 6) >> 2;

result[0] = input0_first6;
result[1] = input0_last2;
if input_len > 1 {
let input1_first4 = input[1] >> 4;
let input1_last4 = std::wrapping_shift_left(input[1], 4) >> 2;
let input1_last4 = (input[1] << 4) >> 2;

result[1] += input1_first4;
result[2] = input1_last4;

if input_len > 2 {
let input2_first2 = input[2] >> 6;
let input2_last6 = std::wrapping_shift_left(input[2], 2) >> 2;
let input2_last6 = (input[2] << 2) >> 2;

result[2] += input2_first2;
result[3] = input2_last6;
Expand Down

0 comments on commit 57f7cd7

Please sign in to comment.