Ignore:
Timestamp:
Sep 29, 2010, 12:25:28 PM (10 years ago)
Author:
sacerdot
Message:

Several bug fixes and code clean-up.
New main file: test.ml to parse and execute an HEX file.
Usage: ./test.native foo.hex

File:
1 edited

Legend:

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

    r137 r138  
    101101    aux 1 (List.rev v)
    102102
    103 let string_of_vect v =
    104  String.concat "" (List.map (function false -> "0" | _ -> "1") v)
    105 
    106103let size_lookup =
    107104  function
     
    132129        true :: aux d
    133130
     131let rec pad i l = if i = 0 then l else false :: (pad (i - 1) l)
     132
    134133let vect_of_int i size =
    135134  let big_list = List.rev (aux i) in
    136     if List.length big_list > (size_lookup size) then
     135    if List.length big_list > size_lookup size then
    137136      raise (Invalid_argument "Size not big enough")
    138137    else
    139       let diff = (size_lookup size) - (List.length big_list) in
    140         pad false diff big_list
     138      let diff = size_lookup size - List.length big_list in
     139        pad diff big_list
    141140   
    142 let zero size = pad false (size_lookup size) []
     141let zero size = pad (size_lookup size) []
Note: See TracChangeset for help on using the changeset viewer.