[PD-cvs] pd/src m_class.c,1.3.4.4,1.3.4.5

Tim Blechmann timblech at users.sourceforge.net
Sun Jan 2 15:48:38 CET 2005


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20547

Modified Files:
      Tag: devel_0_38
	m_class.c 
Log Message:
larger hash table


Index: m_class.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_class.c,v
retrieving revision 1.3.4.4
retrieving revision 1.3.4.5
diff -C2 -d -r1.3.4.4 -r1.3.4.5
*** m_class.c	24 Nov 2004 16:29:02 -0000	1.3.4.4
--- m_class.c	2 Jan 2005 14:48:33 -0000	1.3.4.5
***************
*** 502,506 ****
--- 502,514 ----
  /* ---------------- the symbol table ------------------------ */
  
+ /* tb: new 16 bit hash table: multiplication hash */
+ #define NEWHASH
+ 
+ #ifndef NEWHASH
  #define HASHSIZE 1024
+ #else 
+ #define HASHSIZE 65536
+ #define HASHFACTOR 40503 /* donald knuth: (sqrt(5) - 1)/2*pow(2,16) */
+ #endif
  
  /* tb: made dogensym() threadsafe */
***************
*** 513,517 ****
  	
  	t_symbol **sym1, *sym2;
!     unsigned int hash1 = 0,  hash2 = 0;
      int length = 0;
      char *s2 = s;
--- 521,529 ----
  	
  	t_symbol **sym1, *sym2;
! #ifdef NEWHASH
!     unsigned short hash1 = 0, hash2 = 0;
! #else
!     unsigned int hash1 = 0, hash2 = 0;
! #endif
      int length = 0;
      char *s2 = s;
***************
*** 523,527 ****
          s2++;
      }
!     sym1 = symhash + (hash2 & (HASHSIZE-1));
      while (sym2 = *sym1)
      {
--- 535,544 ----
          s2++;
      }
! #ifdef NEWHASH 
! 	hash2 = hash2 * HASHFACTOR;
! 	sym1 = symhash + hash2;
! #else
! 	sym1 = symhash + (hash2 & (HASHSIZE-1));
! #endif
      while (sym2 = *sym1)
      {





More information about the Pd-cvs mailing list