Changeset 27395 in project


Ignore:
Timestamp:
09/09/12 00:44:59 (7 years ago)
Author:
ecloud
Message:

byte vectors and bit vectors are unsigned

Location:
release/4/endian-port/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/endian-port/trunk/endian-port.scm

    r27394 r27395  
    506506                       (let loop ((i 0) (bytes 0))
    507507                                 (if (< i len)
    508                                      (loop (+ i 1) (+ bytes (endian-port-write-int1 eport (u8vector-ref u8vect i))))
     508                                     (loop (+ i 1) (+ bytes (endian-port-write-uint1 eport (u8vector-ref u8vect i))))
    509509                                     bytes))
    510510                       (let loop ((i (- len 1)) (bytes 0))
    511511                                 (if (positive? i)
    512                                      (loop (- i 1) (+ bytes (endian-port-write-int1 eport (u8vector-ref u8vect i))))
     512                                     (loop (- i 1) (+ bytes (endian-port-write-uint1 eport (u8vector-ref u8vect i))))
    513513                                     bytes))))))
    514514
     
    543543                                                       (if (bit-vector-ref (+ i 6) bv) #b00000010 0)
    544544                                                       (if (bit-vector-ref (+ i 7) bv) #b00000001 0))))
    545                                (loop (+ i 8) (+ bytes (endian-port-write-int1 eport byte))))
     545                               (loop (+ i 8) (+ bytes (endian-port-write-uint1 eport byte))))
    546546                               bytes))
    547547                       (let loop ((i (- len 1)) (bytes 0))
     
    555555                                                       (if (bit-vector-ref (- i 6) bv) #b01000000 0)
    556556                                                       (if (bit-vector-ref (- i 7) bv) #b10000000 0))))
    557                                (loop (- i 8) (+ bytes (endian-port-write-int1 eport byte)))
     557                               (loop (- i 8) (+ bytes (endian-port-write-uint1 eport byte)))
    558558                               bytes)))))))
    559559) ;; end of module
  • release/4/endian-port/trunk/tests/run.scm

    r26431 r27395  
    1212        (endian-port-write-byte-vector outp (blob->u8vector (string->blob "'error: bad argument count'")))
    1313        (endian-port-write-byte-vector outp (u8vector->endian-blob (blob->u8vector (string->blob "always one more bug")) LSB))
     14        (endian-port-write-byte-vector outp (u8vector->endian-blob  (u8vector 256 255 254 128 127 126 125) LSB))
    1415        (close-endian-port outp))
    1516
     
    2526        (print "trying to read u8vector: " (blob->string (endian-port-read-byte-vector inp 27)))
    2627        (print "trying to read u8vector: " (blob->string (endian-port-read-byte-vector inp 19)))
     28        (print "trying to read u8vector of unsigned bytes: " (blob->u8vector (endian-port-read-byte-vector inp 7)))
    2729        (close-endian-port inp))
    2830
Note: See TracChangeset for help on using the changeset viewer.