Changeset 46 for Deliverables/D4.1/physical.ml
 Timestamp:
 Sep 8, 2010, 6:09:01 PM (10 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Deliverables/D4.1/physical.ml
r44 r46 24 24 25 25 let int_of_byte (n1,n2) = int_of_nibble n2 + int_of_nibble n1 * 16 26 27 let int_of_byte7 (b1,b2,b3,n2) = int_of_nibble n2 + int_of_bit b3 * 16 + 28 int_of_bit b2 * 32 + int_of_bit b1 * 64 26 29 27 30 let int_of_word (b1,b2) = int_of_byte b2 + int_of_byte b1 * 256 … … 113 116 let byte_of_byte7 (b1,b2,b3,n) = 114 117 (false,b1,b2,b3),n 118 119 let nth_bit pos ((b1,b2,b3,b4),(b5,b6,b7,b8)) = 120 match pos with 121 0 > b1 122  1 > b2 123  2 > b3 124  3 > b4 125  4 > b5 126  5 > b6 127  6 > b7 128  7 > b8 129 130 let set_nth_bit pos v ((b1,b2,b3,b4) as n1,((b5,b6,b7,b8) as n2)) = 131 match pos with 132 0 > ((v,b2,b3,b4),n2) 133  1 > ((b1,v,b3,b4),n2) 134  2 > ((b1,b2,v,b4),n2) 135  3 > ((b1,b2,b3,v),n2) 136  4 > (n1,(v,b6,b7,b8)) 137  5 > (n1,(b5,v,b7,b8)) 138  6 > (n1,(b5,b6,v,b8)) 139  7 > (n1,(b5,b6,b7,v))
Note: See TracChangeset
for help on using the changeset viewer.