Commits

evhan  committed cb7b0b8

use fx arith for callback table's keys

  • Participants
  • Parent commits 81f7516

Comments (0)

Files changed (1)

File git-lolevel.scm

 ;;;
 
 (define-values (callback-lookup callback-unregister! callback-register!)
-  (let ((callback-index 1)
-        (callback-table (make-hash-table)))
+  (let ((callback-index 0)
+        (callback-table (make-hash-table fx=)))
     (values
      (lambda (i) (hash-table-ref callback-table (pointer->address i)))
      (lambda (i) (hash-table-delete! callback-table (pointer->address i)))
      (lambda (c)
        (let ((index callback-index))
          (hash-table-set! callback-table index c)
-         (set! callback-index (+ index 1))
+         (set! callback-index (fxmod (fx+ index 1) most-positive-fixnum))
          (address->pointer index))))))
 
 (define (call-with-callback c proc)