Ignore:
Timestamp:
Sep 17, 2010, 5:12:19 PM (10 years ago)
Author:
mulligan
Message:

Adding bit vector file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D4.1/Byte.ml

    r85 r86  
    2323
    2424  val to_bit: byte -> bit option
     25  val to_bits: byte -> bit list
    2526  val to_nibble: byte -> nibble option
    2627  val to_int: byte -> int
     
    128129      else
    129130        None
     131  let to_bits (n1, n2) = Nibble.to_bits n1 @ Nibble.to_bits n2
    130132  let to_nibble (n1, n2) =
    131133    let (b1, b2, b3, b4) = Nibble.to_bits n1 in
     
    135137      else None
    136138  let to_int (n1, n2) =
    137     let (b1, b2, b3, b4) = Nibble.to_bits n1 in
    138     let (b5, b6, b7, b8) = Nibble.to_bits n2 in
     139    let [b1; b2; b3; b4] = Nibble.to_bits n1 in
     140    let [b5; b6; b7; b8] = Nibble.to_bits n2 in
    139141      (128 * Bit.to_int b8) + (64 * Bit.to_int b8) +
    140142      (32 * Bit.to_int b8) + (16 * Bit.to_int b8) +
Note: See TracChangeset for help on using the changeset viewer.