File: crypt_aux.ml

package info (click to toggle)
cryptgps 0.2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 292 kB
  • ctags: 420
  • sloc: ml: 2,627; sh: 180; ansic: 172; makefile: 120
file content (35 lines) | stat: -rw-r--r-- 815 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(* $Id$
 * ----------------------------------------------------------------------
 *
 *)

let quadruple_of_int32 xl xr =
  let xl_msb = Int32.to_int(Int32.shift_right_logical xl 16) in
  let xl_lsb = (Int32.to_int xl) land 0xffff in
  let xr_msb = Int32.to_int(Int32.shift_right_logical xr 16) in
  let xr_lsb = (Int32.to_int xr) land 0xffff in
  (xl_msb,xl_lsb,xr_msb,xr_lsb)
;;


let int32_of_quadruple (xl_msb,xl_lsb,xr_msb,xr_lsb) ret_xl ret_xr =
  let xl = 
    Int32.logor
      (Int32.of_int xl_lsb)
      (Int32.shift_left (Int32.of_int xl_msb) 16)
  in
  let xr = 
    Int32.logor
      (Int32.of_int xr_lsb)
      (Int32.shift_left (Int32.of_int xr_msb) 16)
  in
  ret_xl := xl;
  ret_xr := xr
;;

(* ======================================================================
 * History:
 * 
 * $Log$
 * 
 *)