Ignore:
Timestamp:
May 19, 2011, 4:03:04 PM (9 years ago)
Author:
ayache
Message:

32 and 16 bits operations support in D2.2/8051

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/utilities/miscPottier.ml

    r740 r818  
     1
     2let rec map3 f al bl cl =
     3  let f' ((a, b), c) = f a b c in
     4  List.map f' (List.combine (List.combine al bl) cl)
    15
    26let rec max_list = function
     
    48  | [a] -> a
    59  | a :: l -> max a (max_list l)
     10
     11let rec reduce l1 l2 = match l1, l2 with
     12  | [], _ -> (([], []), ([], l2))
     13  | _, [] -> (([], l1), ([], []))
     14  | a :: l1, b :: l2 ->
     15    let ((common1, rest1), (common2, rest2)) = reduce l1 l2 in
     16    ((a :: common1, rest1), (b :: common2, rest2))
    617
    718let pow a b =
     
    4354
    4455let foldi f a l = foldi_from_until 0 (List.length l) f a l
     56
     57let pos e l =
     58  let f i res e' = if e' = e then Some i else res in
     59  match foldi f None l with
     60    | None -> raise Not_found
     61    | Some i -> i
    4562
    4663let iteri f l =
Note: See TracChangeset for help on using the changeset viewer.