chickadee » srfi-60 » copy-bit-field

copy-bit-field to from start endprocedure

Returns an integer the same as to except possibly in the start (inclusive) through end (exclusive) bits, which are the same as those of from. The 0-th bit of from becomes the startth bit of the result.

Example:

(number->string (copy-bit-field #b1101101010 0 0 4) 2)
   ; => "1101100000"
(number->string (copy-bit-field #b1101101010 -1 0 4) 2)
   ; => "1101101111"
(number->string (copy-bit-field #b110100100010000 -1 5 9) 2)
   ; => "110100111110000"