Skip to content

Commit

Permalink
sort aliases for binary search
Browse files Browse the repository at this point in the history
  • Loading branch information
pepijndevos committed Nov 19, 2020
1 parent e79cfdc commit 96f5e82
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apycula/gowin_bba.py
Expand Up @@ -112,7 +112,9 @@ def write_grid(b, grid):

def write_global_aliases(b, db):
with b.block('aliases') as blk:
for (drow, dcol, dest), (srow, scol, src) in db.aliases.items():
aliases = sorted(db.aliases.items(),
key=lambda i: (i[0][0], i[0][1], id_string(i[0][2])))
for (drow, dcol, dest), (srow, scol, src) in aliases:
b.u16(drow)
b.u16(dcol)
b.u16(id_string(dest))
Expand Down

0 comments on commit 96f5e82

Please sign in to comment.