Skip to content

Commit

Permalink
final tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
DavePearce committed Feb 24, 2025
1 parent 756f252 commit 65b8897
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion pkg/air/gadgets/lexicographic_sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import (
// ensure it is positive. The delta column is constrained to a given bitwidth,
// with constraints added as necessary to ensure this.
func ApplyLexicographicSortingGadget(prefix string, columns []uint, signs []bool, bitwidth uint, schema *air.Schema) {
fmt.Printf("Columns: source (%d) vs signs (%d), bitwidth: %d\n", len(columns), len(signs), bitwidth)
// Check preconditions
if len(columns) < len(signs) {
panic("Inconsistent number of columns and signs for lexicographic sort.")
Expand Down
6 changes: 3 additions & 3 deletions pkg/mir/lower.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ func lowerSortedConstraintToAir(c SortedConstraint, mirSchema *Schema, airSchema
sources[i] = air_gadgets.Expand(c.Context, sourceBitwidth, source, airSchema)
}
// Determine number of ordered columns
ncols := len(c.Signs)
numSignedCols := len(c.Signs)
// finally add the constraint
if ncols == 1 {
if numSignedCols == 1 {
// For a single column sort, its actually a bit easier because we don't
// need to implement a multiplexor (i.e. to determine which column is
// differs, etc). Instead, we just need a delta column which ensures
Expand All @@ -231,7 +231,7 @@ func lowerSortedConstraintToAir(c SortedConstraint, mirSchema *Schema, airSchema
// Sanity check bitwidth
bitwidth := uint(0)

for i := 0; i < ncols; i++ {
for i := 0; i < numSignedCols; i++ {
// Extract bitwidth of ith column
ith := mirSchema.Columns().Nth(sources[i]).DataType.AsUint().BitWidth()
if ith > bitwidth {
Expand Down

0 comments on commit 65b8897

Please sign in to comment.