From a3ae2e9125e7c649dc1a8175e746a4e344c404e7 Mon Sep 17 00:00:00 2001 From: uz Date: Sat, 27 Oct 2012 19:32:42 +0000 Subject: [PATCH] Minor code optimization. git-svn-id: svn://svn.cc65.org/cc65/trunk@5883 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/ca65/symtab.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ca65/symtab.c b/src/ca65/symtab.c index 116e7a0c3..776f005b1 100644 --- a/src/ca65/symtab.c +++ b/src/ca65/symtab.c @@ -428,15 +428,18 @@ SymEntry* SymFindAny (SymTable* Scope, const StrBuf* Name) * never create a new symbol, since this can only be done in one specific * scope. */ -{ +{ + /* Generate the name hash */ + unsigned Hash = HashBuf (Name); + + /* Search for the symbol */ SymEntry* Sym; do { /* Search in the current table. Ignore entries flagged with SF_UNUSED, * because for such symbols there is a real entry in one of the parent * scopes. */ - unsigned Hash = HashBuf (Name) % Scope->TableSlots; - if (SymSearchTree (Scope->Table[Hash], Name, &Sym) == 0) { + if (SymSearchTree (Scope->Table[Hash % Scope->TableSlots], Name, &Sym) == 0) { if (Sym->Flags & SF_UNUSED) { Sym = 0; } else { -- 2.39.5