Changeset 38269 in project


Ignore:
Timestamp:
03/15/20 03:26:30 (2 weeks ago)
Author:
Kon Lovett
Message:

condense wordsize code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/bloom-filter/trunk/bloom-filter.scm

    r38147 r38269  
    3939  bloom-filter-exists?)
    4040
    41 (import scheme
    42   (chicken base)
    43   (chicken fixnum)
    44   (chicken flonum)
    45   (chicken type)
    46   (chicken memory)
    47   (only (srfi 1) list-copy take! reverse!)
    48   iset
    49   message-digest-primitive
    50   message-digest-type
    51   message-digest-item
    52   (only type-checks
    53     define-check+error-type
    54     check-positive-fixnum check-flonum check-open-interval check-list)
    55   (only type-errors-basic signal-bounds-error))
    56 
    57 ;;;(should be able to get from module)
     41(import scheme)
     42(import (chicken base))
     43(import (chicken fixnum))
     44(import (chicken flonum))
     45(import (chicken type))
     46(import (chicken memory))
     47(import (only (srfi 1) list-copy take! reverse!))
     48(import iset)
     49(import message-digest-primitive)
     50(import message-digest-type)
     51(import message-digest-item)
     52(import (only type-checks
     53  define-check+error-type
     54  check-positive-fixnum check-flonum check-open-interval check-list))
     55(import (only type-errors-basic signal-bounds-error))
     56
     57;;;
     58
     59;FIXME should be able to get type as module export
    5860
    5961(define-type iset:integer-set *)
    60 
    61 ;;;
    62 
    6362(define-type boolean-set iset:integer-set)
    6463
     
    8079;;
    8180
    82 (define-constant MACHINE-WORD-SIZE
    83   (cond-expand
    84     (64bit
    85       8 )
    86     (else
    87       4 ) ) )
     81(define-constant MACHINE-WORD-SIZE (cond-expand (64bit 8) (else 4)))
    8882
    8983(define-inline (object-data-pointer obj)
     
    9791  (pointer-word-offset (object-data-pointer obj) idx) )
    9892
    99 (cond-expand
    100   (64bit
    101     (: wordvector64-ref unsigned-native-integer-getter)
    102     (define (wordvector64-ref obj idx)
    103       (pointer-u64-ref (object-data-offset obj idx)) ) )
    104   (else
    105     (: wordvector32-ref unsigned-native-integer-getter)
    106     (define (wordvector32-ref obj idx)
    107       (pointer-u32-ref (object-data-offset obj idx)) ) ) )
     93;NOTE ((cond-expand (64bit pointer-u64-ref) (else ...) (object-data-offset ...))) Fails!
    10894
    10995(: wordvector-ref unsigned-native-integer-getter)
    11096;
    111 (define wordvector-ref
     97(define (wordvector-ref obj idx)
    11298  (cond-expand
    113     (64bit
    114       wordvector64-ref )
    115     (else
    116       wordvector32-ref ) ) )
     99    (64bit  (pointer-u64-ref (object-data-offset obj idx)))
     100    (else   (pointer-u32-ref (object-data-offset obj idx)))) )
    117101
    118102;;; Record Type
Note: See TracChangeset for help on using the changeset viewer.