Skip to content
Permalink
Browse files

Update LongElement.java

Fix in the align() method. Note: this method is not called by any of the example circuits of this project. The method was from an outdated implementation, and it's just left as a utility or example for now.
  • Loading branch information...
akosba committed May 1, 2019
1 parent d4a4f88 commit 545be441ea4c49119012739ab86f0f9fd6c33459
Showing with 3 additions and 3 deletions.
  1. +3 −3 JsnarkCircuitBuilder/src/circuit/auxiliary/LongElement.java
@@ -316,7 +316,7 @@ public int getSize() {
}

public void align(int totalNumChunks) {

// TODO set bits
array = Arrays.copyOfRange(array, 0, totalNumChunks);
for (int i = 0; i < array.length; i++) {
if (array[i] == null) {
@@ -329,12 +329,12 @@ public void align(int totalNumChunks) {

for (int i = 0; i < totalNumChunks; i++) {
if (newMaxValues[i].bitLength() > CHUNK_BITWIDTH) {
Wire[] chunkBits = array[i].getBitWires(currentBitwidth[i])
Wire[] chunkBits = array[i].getBitWires(newMaxValues[i].bitLength())
.asArray();
array[i] = new WireArray(Arrays.copyOfRange(chunkBits, 0,
CHUNK_BITWIDTH)).packAsBits();
Wire rem = new WireArray(Arrays.copyOfRange(chunkBits,
CHUNK_BITWIDTH, currentBitwidth[i])).packAsBits();
CHUNK_BITWIDTH, newMaxValues[i].bitLength())).packAsBits();
if (i != totalNumChunks - 1) {
newMaxValues[i + 1] = newMaxValues[i].shiftRight(
CHUNK_BITWIDTH).add(newMaxValues[i + 1]);

0 comments on commit 545be44

Please sign in to comment.
You can’t perform that action at this time.