Changeset 39748 in project
 Timestamp:
 03/21/21 17:52:11 (4 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

release/5/srfi69/trunk/srfi69.scm
r37833 r39748 497 497 (lambda (test hash len minload maxload weakkeys weakvalues initial 498 498 #!optional (vec (makevector len '()))) 499 (let ((ht (##sys#makestructure 'hashtable 500 vec 0 test hash minload maxload #f #f initial #f))) 499 (let* ((minloadlen (inexact>exact (floor (* len minload)))) ;; Cached values to speed up hashtablecheckresize! 500 (maxloadlen (inexact>exact (floor (* len maxload)))) 501 (ht (##sys#makestructure 'hashtable 502 vec 0 test hash minload maxload #f #f initial #f minloadlen maxloadlen))) 501 503 (##sys#setslot ht 10 (*makehashfunction hash)) 502 504 ht) ) ) ) … … 696 698 697 699 (define (hashtableresize! ht vec len) 698 (let* ([deslen (fxmin hashtablemaxlength (fx* len hashtablenewlengthfactor))] 699 [newlen (hashtablecanonicallength hashtableprimelengths deslen)] 700 [vec2 (makevector newlen '())] ) 700 (let* ((deslen (fxmin hashtablemaxlength (fx* len hashtablenewlengthfactor))) 701 (newlen (hashtablecanonicallength hashtableprimelengths deslen)) 702 (minload (##sys#slot ht 5)) 703 (newminloadlen (inexact>exact (floor (* len minload)))) 704 (maxload (##sys#slot ht 6)) 705 (newmaxloadlen (inexact>exact (floor (* len maxload)))) 706 (vec2 (makevector newlen '())) ) 701 707 (hashtablerehash! vec vec2 (##sys#slot ht 10)) 702 (##sys#setslot ht 1 vec2) ) ) 708 (##sys#setslot ht 1 vec2) 709 (##sys#setslot ht 11 newminloadlen) 710 (##sys#setslot ht 12 newmaxloadlen)) ) 703 711 704 712 ;; hashtablecheckresize!: 705 713 706 714 (defineinline (hashtablecheckresize! ht newsiz) 707 (let ([vec (##sys#slot ht 1)] 708 [minload (##sys#slot ht 5)] 709 [maxload (##sys#slot ht 6)] ) 710 (let ([len (##sys#size vec)] ) 711 (let ([minloadlen (inexact>exact (floor (* len minload)))] 712 [maxloadlen (inexact>exact (floor (* len maxload)))] ) 713 (if (and (fx< len hashtablemaxlength) 714 (fx<= minloadlen newsiz) (fx<= newsiz maxloadlen)) 715 (hashtableresize! ht vec len) ) ) ) ) ) 715 (let* ((vec (##sys#slot ht 1)) 716 (minloadlen (##sys#slot ht 11)) 717 (maxloadlen (##sys#slot ht 12)) 718 (len (##sys#size vec))) 719 (if (and (fx< len hashtablemaxlength) 720 (fx<= minloadlen newsiz) (fx<= newsiz maxloadlen)) 721 (hashtableresize! ht vec len) ) ) ) 716 722 717 723 ;; hashtablecopy:
Note: See TracChangeset
for help on using the changeset viewer.