Skip to content

Commit

Permalink
Fix argument order of StoreHashTable
Browse files Browse the repository at this point in the history
The arguments were passed to this function in the wrong order --
this greatly slowed GAP as the hash table would never match
  • Loading branch information
ChrisJefferson authored and wilfwilson committed Jun 10, 2021
1 parent 4de2d33 commit 6062d54
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/opers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,7 @@ static Obj FuncAND_FLAGS(Obj self, Obj flags1, Obj flags2)
template <Int len>
static Obj LookupHashTable(Obj ht, Int hash, Obj flags)
{
GAP_ASSERT(TNUM_OBJ(flags) == T_FLAGS);
for (int hash_loop = 0; hash_loop < 3; ++hash_loop) {
if (ELM_PLIST(ht, hash * 2 + 1) == flags) {
return ELM_PLIST(ht, hash * 2 + 2);
Expand All @@ -654,9 +655,10 @@ static Obj LookupHashTable(Obj ht, Int hash, Obj flags)
}

template <Int len>
static void StoreHashTable(Obj ht, Int hash, Obj new_flags, Obj new_with)
static void StoreHashTable(Obj ht, Int hash, Obj new_with, Obj new_flags)
{
Obj old_with, old_flags;
GAP_ASSERT(TNUM_OBJ(new_flags) == T_FLAGS);

// add to hash table, shuffling old values along (last one falls off)
for (int hash_loop = 0; hash_loop < 3; ++hash_loop) {
Expand Down

0 comments on commit 6062d54

Please sign in to comment.